Program 4: Tumbling Dice.ZIP

Program 4: Tumbling Dice

The purpose of this programming assignment is to help you gain experience using looping constructs.
AssignmentAlice and Bob roll a fair, six-sided single die repeatedly. Alice is waiting until all six of the die's faces appear at least once. Bob is waiting for some face (any face) to appear four times. The winner is the one who gets his or her wishe first. For example, if the successive rolls are 2, 5, 4, 5, 3, 6, 6, 5, 1, then Alice wins, since all numbers have appeared, none more than three times. If the successive rolls instead happen to be 4, 6, 3, 6, 6, 1, 2, 2, 6, then Bob wins because he has seen four 6s and no 5 (yet). Write a computer program that simulates one million games. The program should print out the percentage of the time that each player wins.Note: This problem is adapted from the "Puzzled" page of the February 2013 issue of the Communications of the ACM.Instructions
Design a solution to this problem. The design should include the classes you plan to use, a description of each instance variable that a class needs, an English description of each method that a class needs, etc. You might find it helpful to draw pictures.
Create a BlueJ project named Program4.
Implement your design. Note: if you design first, you are likely to develop a superior solution in a shorter amount of time as opposed to jumping head-first into coding.
Output FormatWhen the program is run, it should produce output in the following format:Alice's winning percentage: 46.294 Bob's winning percentage: 53.706 Note: the above percentages are not correct!Grading - 100 points
25 points - the simulation works correctly. The percentages must be accurate to within 0.2 in order to receive these points.
20 points - the instance variables in each class are reasonable. For each instance variable that should be a local variable, 4 points will be deducted.
10 points - the classes in your solution indicate that you are solving the problem using good object-oriented principles. These 10 points are all or nothing.
10 points - the methods in each class are reasonable and indicate a good use of object-oriented principles. For each method mistake (e.g. private when it should be public, an unnecessary method, etc.), 2 points will be deducted.
10 points - each time a loop is needed, the most appropriate type of loop (for, while, do-while) is used. For each incorrect loop choice, 5 points will be deducted.
10 points - Redundant code is avoided throughout the solution. For each significant redundancy, 3 points will be deducted.
10 points - Javadoc is used properly throughout the solution. For each incorrect use of Javadoc, 2 points will be deducted.
5 points - the output format matches the sample output above (3 points) and percentages are printed with 3 digits to the right of the decimal (2 points).
Powered by