Write an application that uses your Dice class to simulate an experiment that consists of rolling a pair of dice a specified number of times.
Generate a table with three columns: Dot Sum, Frequency, and Probability. The body of the table will contain the frequencies and probabilities for dot sums ranging from 2 to 12.
The user will enter the number of trials in the simulated experiment from the keyboard.
Roll the dice the specified number of times keeping track of the number of times you got 2, 3, 4, and so on. After the dice have been rolled the specified number of times, calculate the empirical probabilities by dividing the observed frequencies by the number of trials. For example, in the first experiment in the sample run shown below, a dot sum of 2 occurred 25 times in 1,000 rolls of the dice. The empirical probability of getting a dot sum of 2 is 25/1000 or 0.025. The sum of the frequencies should always be the number of trials and the sum of the probabilities should always be exactly 1.
Your application should utilize a graphical user interface that has a text field for the number of trials, a text area to display the output, a button to clear the output area, a button to run the experiment, and a button to terminate the program.
The first sample run represents an experiment with 1,000 trials. Your results should be similar but not exactly the same because we are simulating random events.
The second sample run represents an experiment with 1,000,000 trials. Your results should be similar but not exactly the same because we are simulating random events.
I'll give you 5 bonus points if your application looks like the illustration below without any resizing necessary.
Submit your Hmwk14.java application and your Dice.java class file as attachments to an email message whose subject is "Hmwk14".