Run this program several times to show different results


1. Write program that will simulate rolling a die. Name your program RollingDie.java. Run this program several times to show different results. Remember, Math.random() generates a double value with a positive sign, greater than or equal to 0 and less than 1.

2. Ask the user to enter a number between 1-5. Based on what number user entered, show a random quote. For instance, you have the following 5 quotes defined in your program:

Quote 1: Many people despise wealth, but few know how to give it away.

Quote 2: We are never deceived; we deceive ourselves.

Quote 3: Sometimes the questions are complicated and the answers are simple.

Quote 4: Whenever you find that you are on the side of the majority, it is time to reform.

Quote 5: Frequency of a tragedy does not diminish the wound when it is your own.

If user enters 2, you will display: We are never deceived; we deceive ourselves.

Use if/else if/else statements to write the program. Name your program RandomQuote.java.

3. Rewrite RandomQuotes program by using switch/case statements. Name your program RandomQuoteSwitch.java.

4. Create zip file that contains your Java programs. Include a screenshot of each program execution. You can either paste the screenshot into a Word document or simply paste it into the Comments field when submitting your homework. A sample screenshot of running my programs is attached below:

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Run this program several times to show different results
Reference No:- TGS02635672

Now Priced at $20 (50% Discount)

Recommended (90%)

Rated (4.3/5)