Write a program that will ask the user to input the number of dice to roll,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that will ask the user to input the number of dice to roll, and the number of sides on the dice. It will then roll the dice and show the results of each roll as well as the total of the dice rolls. Your program must use a method to simulate the rolling of the dice. Submit your complete Java code (source code only, java file) by due date Sample Execution 1: Enter the number of dice to roll: 5 Enter the number of sides on the dice: 15 Dice #1 Comes up: 5 Dice #2 Comes up: 4 Dice #3 Comes up: 6 Dice #4 Comes up: 4 Dice #5 Comes up: 13 After rolling 5 dice with 15 sides, the total is: 32 Sample Execution 2: Enter the number of dice to roll:7 Enter the number of sides on the dice:8 Dice #1 Comes up: 3 Dice #2 Comes up: 6 Dice #3 Comes up: 6 Dice #4 Comes up: 4 Dice #5 Comes up: 1 Dice #6 Comes up: 1 Dice #7 Comes up: After rolling 7 dice with 8 sides, the total is: 22 Write a program that will ask the user to input the number of dice to roll, and the number of sides on the dice. It will then roll the dice and show the results of each roll as well as the total of the dice rolls. Your program must use a method to simulate the rolling of the dice. Submit your complete Java code (source code only, java file) by due date Sample Execution 1: Enter the number of dice to roll: 5 Enter the number of sides on the dice: 15 Dice #1 Comes up: 5 Dice #2 Comes up: 4 Dice #3 Comes up: 6 Dice #4 Comes up: 4 Dice #5 Comes up: 13 After rolling 5 dice with 15 sides, the total is: 32 Sample Execution 2: Enter the number of dice to roll:7 Enter the number of sides on the dice:8 Dice #1 Comes up: 3 Dice #2 Comes up: 6 Dice #3 Comes up: 6 Dice #4 Comes up: 4 Dice #5 Comes up: 1 Dice #6 Comes up: 1 Dice #7 Comes up: After rolling 7 dice with 8 sides, the total is: 22
Expert Answer:
Answer rating: 100% (QA)
Heres the Java code that simulates rolling dice based on user input java import javautilRandom impor... View the full answer
Posted Date:
Students also viewed these programming questions
-
A randomized block design is used to compare four treatments in eight blocks. a. Use the Friedman Fr-test to detect differences in location among the four treatment distributions. Test using...
-
The following two samples were collected as matched pairs: a. State the null and alternative hypotheses to test if the population represented by Sample 1 has a higher mean than the population...
-
A woman flies from Phoenix to Denver (a distance of 800 mi) at a rate 40 mph faster than on the return trip. If the total time of the trip is 9 hrs, what was her rate going to Denver, and what was...
-
Which is more stable from day to day, the discount rate or the federal funds rate? Explain.
-
The 6-cm-diameter 20°C water jet in Fig P3.64 strikes a plate containing a hole of 4-cm diameter. Part of the jet passes through the hole, and part is deflected. Determine the horizontal force...
-
What type of documents can be obtained through document requests?
-
Rishi Singh has $1,500 to invest. His investment counselor suggests an investment that pays no stated interest but will return $2,000 at the end of 3 years. a. What annual rate of return will Rishi...
-
Sow Tire, Incorporated has sales of $ 1 , 4 4 1 , 0 0 0 and cost of goods sold of $ 1 , 2 4 1 , 0 0 0 . The firm had an average inventory of $ 9 6 , 1 0 0 and an ending inventory of $ 7 7 , 5 0 0 ....
-
According to molecular orbital theory, which of the following will not be a viable molecule? (1) He2^+2 (2) H^- (3) He2^+ (4) H^-
-
Describe some of the history and current practice of race in the United States.
-
Discuss the relationship between social stratification, wealth, power, and prestige.
-
Analyze social class differences in the United States by relating income inequality, class mobility, and class subcultures.
-
Explain the ways that ideas of race are linked to culture and history.
-
Compare and contrast different theories of social stratification.
-
Write a brief note on Drone Technology in which you need to address the following: Introduction Brief Analysis of UNICEFs Drone Technology Drone applications Conclusion
-
Why did management adopt the new plan even though it provides a smaller expected number of exposures than the original plan recommended by the original linear programming model?
-
First Federal S & L has an online real-time system, with terminals installed in all of its branches. This system will not accept a customers cash withdrawal instructions in excess of \($1,000\)...
-
Which of the following is an example of a check digit? a. An agreement of the total number of employees to the total number of checks printed by the computer. b. A logic test that ensures all...
-
A computer input control is designed to ensure that a. Machine processing is accurate. b. Only authorized personnel have access to the computer area. c. Computer processing has been performed as...
Study smarter with the SolutionInn App