| 12345678910111213141516171819202122232425262728293031 |
-
- public class Simulation
- {
- int numOfDice;
- int toss; //number of toss I want to toss
- public Simulation(Integer numOfDice,Integer toss){
- this.numOfDice = numOfDice;
- this.toss = toss;
-
- }
-
- public void runSimulation(){
- Bin binny = new Bin();
- Dice dice = new Dice(numOfDice);//need to know how many dice to roll
- for (int i=1;i<=toss;i++){
-
- binny.setBin(dice.tossAndSum());// put the toss value in the bin
- }
- printResults(binny);
- }
-
- public void printResults(Bin binny){
- for(int i=2;i<=12;i++){
-
- System.out.println("SumOfToss " + i + " NumofResult " + binny.getBinValue(i));
- }
-
- }
- }
-
|