|
@@ -10,7 +10,6 @@
|
10
|
10
|
import java.util.*;
|
11
|
11
|
|
12
|
12
|
public class TooLargeTooSmall {
|
13
|
|
-
|
14
|
13
|
public static int randomNumGenerator(){
|
15
|
14
|
// this section starts the game by letting the user select
|
16
|
15
|
// a game mode
|
|
@@ -58,7 +57,6 @@ public class TooLargeTooSmall {
|
58
|
57
|
|
59
|
58
|
Scanner keyboard = new Scanner(System.in);
|
60
|
59
|
// While loop until guess is correct.
|
61
|
|
- // interacts with other methods
|
62
|
60
|
// guess checker - will check guess against other guesses
|
63
|
61
|
// boolean, if currentGuess = previousGuess, repeatGuess = true/false
|
64
|
62
|
|
|
@@ -77,17 +75,18 @@ public class TooLargeTooSmall {
|
77
|
75
|
guessFound = true;
|
78
|
76
|
|
79
|
77
|
} else {
|
80
|
|
- // check guess
|
|
78
|
+ // check guess against previous guess update counter
|
81
|
79
|
if (currentGuess != previousGuess) {
|
82
|
80
|
guessCounter++;
|
83
|
81
|
previousGuess = currentGuess;
|
84
|
82
|
}
|
|
83
|
+ if (currentGuess > numberToGuess) {
|
|
84
|
+ System.out.println("Number was too large!");
|
|
85
|
+ } else {
|
|
86
|
+ System.out.println("Number was too small!");
|
|
87
|
+ }
|
85
|
88
|
System.out.println("That wasn't the right answer. Guess again!");
|
86
|
89
|
}
|
87
|
90
|
}
|
88
|
|
-
|
89
|
|
- System.out.println("");
|
90
|
|
-
|
91
|
91
|
}
|
92
|
|
-
|
93
|
92
|
}
|