ST: Java Programming

Program 1: A Dicey Assignment

Your frst program will use a supplied class called Die to run some dice tossing experiments. You are to generate a frequency table for the number of times certain totals appear when you toss one or more dice.

The program accepts three command line arguments, the number of dice, the number of "spots" on each die, and the number of tosses to be performed. At the conclusion of the simulation, it will print a table telling the number of times (and percentage) each possible total was obtained.

Name your class Dice. Here is sample output for two runs of the program.
>java Dice 1 2 1000
Throwing 1 die
Each Die has 2 spots
1000 Trials
Total   Freq        %
  1      487     48.7
  2      513     51.3
>
>java Dice 2 6 750
Throwing 2 die
Each Die has 6 spots
750 Trials
Total   Freq        %
  2     results
  3     not available
  4     for sample
  ...
 12
>
This is an application. Use an array to store the frequencies. A class Die is provided. You may look at the source code and download the class file. Put the class file in the same folder as your Dice class. In addition, you might want to visit a project that shows how to access command line arguments.

Submit your project via email as an attachment. I would like both the source and bytecode files for Dice. My email is margush@uakron.edu.