One: -Write a program that replaces all instances of one letter with another. -You may only use the methods we have discussed. --length(). --substring(). --indexOf(). --compareTo(). --equals()....

1 answer below »
One:
-Write a program that replaces all instances of one letter with another.
-You may only use the methods we have discussed.
--length().
--substring().
--indexOf().
--compareTo().
--equals().
--toLowerCase().
--toUpperCase().
--charAt().
-Get all values from the user.
-Do not adjust for casing.
Two:
-Write a program that simulates rolling 2 standard dice 10,000 times.
--Use Math.random().
-Count the number of sevens rolled. (Sum of rolls)
-Print out this sum.
Three:
-Get a base-10 number as input.
-Convert it into a base-2 number.
-Display results.
Four:
-Write a program that will simulate the toss of 2 coins and count the number of tosses before two heads are tossed consecutively.
--You will need to use Math.random().
-Print all tosses to make sure the program runs correctly.
-Display number of tosses.
Answered Same DayMay 15, 2021

Solution

Shreyan answered on May 16 2021
27 Votes
import java.util.*;
public class Prob1 {
public static void main(String[] args) {
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Submit New Assignment

Copy and Paste Your Assignment Here