Bold Text HereScenario
A die has six faces labelled 1, 2, ..., 6. When a die is rolled, any face has equal chance of showed up. A class die has, among other methods, the method roll() which rolls the die and the method showFace() which reports the face of the die being shown up.
A class statistics has the following methods
Enter (item), where an item is the number, which adds an item to the data set
getSum(), which returns the sum of all the items that have been added to the data set
getMean(), which returns the average of all the items from the data set
getStdDev(), which returns the standard deviation of all the items in the data set
getMax(), which returns the maximum item from the data set
getMin(),which returns the minimum item from the data set
You may add data members and any other methods of your interest for all classes.
a) Implement the class Die and save it in a file called Die.java
b) Implement the class Statistics and save it in a file called Statistics.java
c) Write down the program that makes use of a die object and a statistics object. This class will report the statistics of a certain face of a die selected by user being shown up when a die is tossed certain number of times decided by user.
Page 2 of 2
1. In this assignment, one toss of a die is equivalent to one experiment. In one experiment a die is rolled 50 times.
2. In one experiment, the number of times the selected face being shown up is recorded and passed to statistics object as an item
3. The statistics are calculated from the number of experiments
4. You should use random() method in rolling a die, but other formulas must be created from the scratch.
5. Sample interrogations between user and program
Enter the face number to test: 6
Enter the number of experiments: 100
The Statistics are:
Sum of items: xxx
Minimum item: nnn
Maximum item: mmm
Mean item: zzz
Standard Deviation: yyy
The assignment will not intimidating you if you follow the following advice
1. Start the assignment today; don’t wait until the last minute. Extension excuse will not be accepted
2. Start small; implement the class Die and test it!, implement the class Statistics and test it! If you are satisfied, use them in your program
Bold Text HereScenario