Question: Write a program that simulates the rolling of a pair of dice. First, write a class called Dice (file Dice.java) that simulates a single dice

 Write a program that simulates the rolling of a pair of

Write a program that simulates the rolling of a pair of dice. First, write a class called Dice (file Dice.java) that simulates a single dice (the singular for dice is die but in modern English dice is an acceptable singular so I will call the class Dice). The Dice class should have the following fields and methods (with these names and caps) Field/Method Description Value SetValue GetValue Roll The Value field holds the value of the dice The SetValue method stores a value in the Value field The GetValue method returns the value of the dice The Roll method that generates a random number in the range of 1 through 6 for the value of the due OutputDice The OutputDice method output the value of the dice as text (e.g. ONE, TWO, THREE, FOUR, FIVE, and SI DrawDice The DrawDice method draw the dice/an image of the dice (on more than one line using ASCII characters and/or symbols) in the console window (not a dialog box); This method is optional (for 5 extra credit points Once you have designed the class, design a program/driver class that creates two objects/instances of the Dice class to simulate a pair of dice. The program should simulate the rolling of the 2 dice and display their values (using the OutputDice method, and, if you did the extra credit, also using the DrawDice method). Document your code (meaning follow the Assignment Code Convention, explain what each line of code does)

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!