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 dice. The program will continue to roll the dice until all dice have the same value, that is of a kind occurs. Process the information from the rolls as specified in the specifications below.
Specifications
Add this assignment to your CS project.
Create a Java class within that project called LastNameFirstNameAssignment
Follow CS Programming Assignments Policy
Write code that:
Simulates rolling dice until of a kind occurs ie 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 & 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:
of a kind, of a kind, of a kind, of a kind
When of a kind occurs, end the while loop, and display the following overall statistics:
o How many times each type of roll occurred ie of a kind, 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 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 of a kind is randomly generated.
Must Do: Use a multiway Ifstatement
Use a multiway ifstatement to determine what kind of roll occurred of a kind, etc.
Must Not Do:
DO NOT use a dowhile 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 valuesresults
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
