Question: Assignment Description In this assignment you will write a simple while loop that simulates the rolling of 4 dice. The program will continue to roll

Assignment Description
In this assignment you will write a simple while loop that simulates the rolling of 4 dice. The program will continue to roll the dice until all dice have the same value, that is,4 of a kind occurs. Process the information from the rolls as specified in the specifications below.
Specifications
1. Add this assignment to your CS1150 project.
2. Create a Java class within that project called LastNameFirstNameAssignment5
3. Follow "CS1150 Programming Assignments Policy
4. Write code that:
Simulates rolling 4 dice until 4 of a kind occurs (i.e., value on all die is the same)
Uses a while loop to do the following processing:
o Roll each die:
Simulate roll by randomly generating a number between 1 & 6 for each die
o Display the following results for each roll:
Roll number
Randomly generated rolled value for each die
Type of roll that occurred:
4 of a kind, 3 of a kind, 2 of a kind, 1 of a kind
When 4 of a kind occurs, end the while loop, and display the following overall statistics:
o How many times each type of roll occurred (i.e.4 of a kind, 3 of a kind, etc.)
o The probability associated with each type of roll for the run of the code.
o The total number of rolls (which will vary each time you run the program)
o The total percent (which is 100%- DO NOT HARDCODE COMPUTE the total %)
Must Do and Tips
Must Do: Use variables of correct types
int should be used for all the counters and the random value of each die
double should be used for the probabilities
String should be used for the type of roll
Must Do: Use a while loop
Use a while loop for the main processing of each roll of the dice.
The while loop must end when 4 of a kind is randomly generated.
Must Do: Use a multi-way If-statement
Use a multi-way if-statement to determine what kind of roll occurred (1 of a kind, etc.)
Must Not Do:
DO NOT use a do-while loop.
DO NOT use System.exit() or break statements to exit the loop.
o Instead, write the loop properly so it completes when the boolean expression is false.
DO NOT use an array or array list to store any values/results.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!