Question: Part A For this part you will create a die ( 6 faces ) class which have those specifications below. The classname will be Die
Part A
For this part you will create a die faces class which have those specifications below. The
classname will be Die
Die class will have a no argument constructor which will initialize faceValue to
Die class will hold private faceValue with integer type as an instance variable.
You will write a method to get the faceValue of the Die.
You will also write a void setFaceValue method to set the faceValue of the die using the method
arguement which will be an integer.
Die class will have a void roll method. This method will roll the die randomly, creating a number
between to both inclusive. In other words, it will change the faceValue randomly. This method
will not print anything.
Part B
For this part you will create a Dice class which holds private Die objects as instance variables.
Die class will have a no argument constructor which will initialize faceValues of the both dies to
You will write a method to get the faceValue of the Dice which is the sum of the faceValues of the
dice.
Die class will have a void roll method. This method will roll both Dice. This method will not print
anything.
Part C
For this part you will create a DiceTester class which will do the following:
name of this class will be your lastname firstname.java
DiceTester will have the main method inside. The other classes won't have any main method inside.
You will roll the dice times. After each roll, you will store number of occurrences of the
faceValues in an integer array.
Then you will print those values starting from until after rolling the Dice times.
You will also draw a histogram graph shown below. They y axis will start from and decrease
by until
Please take note of the spaces on x axis numbers. If the x axis number has one digit there are
spaces. If the x axis number has digits there is one space between them.
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
