Amy Gill 6 years ago
parent
commit
0ba3b812e5
2 changed files with 9 additions and 5 deletions
  1. 6
    2
      src/main/java/Bins.java
  2. 3
    3
      src/main/java/Dice.java

+ 6
- 2
src/main/java/Bins.java View File

2
 
2
 
3
 public class Bins {
3
 public class Bins {
4
 
4
 
5
-    protected HashMap<Integer, Integer> numOfTimesWeveRolledEachNUm;
5
+    protected HashMap<Integer, Integer> numOfTimesWeveRolledEachNUm = new HashMap<Integer, Integer>();
6
 
6
 
7
-    public Bins(Integer minDiceRange, Integer maxDiceRange)
7
+    public Bins(Integer smallestPossible, Integer largestPossible){
8
+        for (Integer key = smallestPossible; key <= largestPossible; key++){
9
+            numOfTimesWeveRolledEachNUm.put(key, 0);
10
+        }
11
+    }
8
 
12
 
9
     public Bins(int start, int end) {
13
     public Bins(int start, int end) {
10
 
14
 

+ 3
- 3
src/main/java/Dice.java View File

34
     }
34
     }
35
 
35
 
36
     public static void main(String[] args) {
36
     public static void main(String[] args) {
37
-        Dice dice = new Dice(1); // for craps
37
+        Dice dice = new Dice(2); // for craps
38
         Dice dice2 = new Dice(5); // for yatzee
38
         Dice dice2 = new Dice(5); // for yatzee
39
 
39
 
40
         Integer toss = dice.tossAndSum();
40
         Integer toss = dice.tossAndSum();
41
         Integer toss2 = dice2.tossAndSum();
41
         Integer toss2 = dice2.tossAndSum();
42
 
42
 
43
-        System.out.println("The ressult of the first toss was " + toss);
44
-        System.out.println("The result of the second toss waS " + toss2);
43
+        System.out.println("The result of the first toss was " + toss);
44
+        System.out.println("The result of the second toss was " + toss2);
45
 
45
 
46
 
46
 
47
 
47