Bladeren bron

Started changing print methods

Lauren Green 6 jaren geleden
bovenliggende
commit
5ad9fba823
1 gewijzigde bestanden met toevoegingen van 14 en 42 verwijderingen
  1. 14
    42
      src/main/java/io/zipcoder/casino/ScoreSheet.java

+ 14
- 42
src/main/java/io/zipcoder/casino/ScoreSheet.java Bestand weergeven

@@ -30,54 +30,26 @@ public class ScoreSheet {
30 30
         return totalScore;
31 31
     }
32 32
 
33
-    public void printRow(ROW row, String description) {
34
-        System.out.print(String.format("%-35s",description));
33
+    public void rowToString(ROW row, String description) {
34
+        String rowInfo = String.format("%-35s",description));
35 35
         if(getScore(row) != null) {
36
-            System.out.println("** " + getScore(row) + " **");
36
+            rowInfo += "\n** " + getScore(row) + " **\n";
37 37
         } else {
38
-            System.out.println("** open **");
38
+            rowInfo += "\n** open **\n";
39 39
         }
40 40
     }
41 41
 
42
-    public void printScoreCard(){
43
-        System.out.print(String.format("%-35s","1. Aces: Totals all Ones"));
44
-        if(getScore(ScoreSheet.ROW.ACES) != null) {
45
-            System.out.println("** " + getScore(ScoreSheet.ROW.ACES) + " **");
46
-        } else {
47
-            System.out.println("** open **");
48
-        }
49
-        System.out.print(String.format("%-35s","2. Twos: Totals all Twos"));
50
-        if(getScore(ScoreSheet.ROW.TWOS) != null) {
51
-            System.out.println("** " + getScore(ScoreSheet.ROW.TWOS) + " **");
52
-        } else {
53
-            System.out.println("** open **");
54
-        }
55
-        System.out.print(String.format("%-35s", "3. Threes: Totals all Threes"));
56
-        if(getScore(ScoreSheet.ROW.THREES) != null) {
57
-            System.out.println("** " + getScore(ScoreSheet.ROW.THREES) + " **");
58
-        } else {
59
-            System.out.println("** open **");
60
-        }
61
-        System.out.print(String.format("%-35s", "4. Fours: Totals all Fours"));
62
-        if(getScore(ScoreSheet.ROW.FOURS) != null) {
63
-            System.out.println("** " + getScore(ScoreSheet.ROW.FOURS) + " **");
64
-        } else {
65
-            System.out.println("** open **");
66
-        }
67
-        System.out.print(String.format("%-35s", "5. Fives: Totals all Fives"));
68
-        if(getScore(ScoreSheet.ROW.FIVES) != null) {
69
-            System.out.println("** " + getScore(ScoreSheet.ROW.FIVES) + " **");
70
-        } else {
71
-            System.out.println("** open **");
72
-        }
73
-        System.out.print(String.format("%-35s", "6. Sixes: Totals all Sixes"));
74
-        if(getScore(ScoreSheet.ROW.SIXES) != null) {
75
-            System.out.println("** " + getScore(ScoreSheet.ROW.SIXES) + " **");
76
-        } else {
77
-            System.out.println("** open **");
78
-        }
42
+    public void scoreCardToString(){
43
+        rowToString(ScoreSheet.ROW.ACES, "1. Aces: Totals all Ones");
44
+        rowToString(ScoreSheet.ROW.TWOS, "2. Twos: Totals all Twos");
45
+        rowToString(ScoreSheet.ROW.THREES, "3. Threes: Totals all Threes");
46
+        rowToString(ScoreSheet.ROW.FOURS, "4. Fours: Totals all Fours");
47
+        rowToString(ScoreSheet.ROW.FIVES, "5. Fives: Totals all Fives");
48
+        rowToString(ScoreSheet.ROW.SIXES, "6. Sixes: Totals all Sixes");
49
+        rowToString(ScoreSheet.ROW.THREEOFAKIND, );
50
+
79 51
         System.out.print(String.format("%-35s", "7. 3 of a Kind"));
80
-        if(getScore(ScoreSheet.ROW.THREEOFAKIND) != null) {
52
+        if(getScore() != null) {
81 53
             System.out.println("** " + getScore(ScoreSheet.ROW.THREEOFAKIND) + " **");
82 54
         } else {
83 55
             System.out.println("** open **");