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
Note that,
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

2 Years
Discussion Span
Last Post by jacks009

I tagged this "java" so the right people wil see it.
Show what effort you have made so far.

What the heck does "one toss of a die is equivalent to one experiment. In one experiment a die is rolled 50 times." mean?

Edited by JamesCherrill


What the heck does "one toss of a die is equivalent to one experiment. In one experiment a die is rolled 50 times." mean?

Dusting off the cobwebs of my statistics coursework long ago, I believe most statisticians would rephrase that sentence as:

one toss of a die is equivalent to one TRIAL. In one EXPERIMENT a die is rolled 50 times.

A trial is the anything that could have an "outcome". In this case, the trial would be the rolling of a die. The "experiment" would be rolling the die 50 times.

But then you could roll the die 50 times 100 times, for a total of 5000 times, where each "50 rolls" would become the base unit. In that case, rolling the die 50 times is the trial and doing the "50 die roll" 100 times is the experiment.

Long story short, some people are very particular about defining the difference between "trial" and "experiment" and "outcome" and some people take a "you know what I mean" approach and use "trial" and "experiment" interchangeably and you have to figure what they want out by going to the context.

This could pose some real problems for the OP in an Object Oriented language like Java where you might have an "Experiment" object and have to define it rigorously. The OP will need to read the spec several times, figure out what is needed, and go from there. Might even need to ask the professor for clarification. This is definitely one of those assignments where figuring out what everything should be defined as and what goes where and how it relates to other things is the primary concern. The coding part is the easy part and should only be attempted after fully deciding on the design part.

This looks like a verbatim homework dump to me though. We'll see whether the OP comes back.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.