File tree Expand file tree Collapse file tree
app/src/main/java/io/github/project516/NumberGuessingGame Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 */
77public class CheckGuess {
88 /**
9- * Validates that a guess is within the acceptable range (1-100 ).
9+ * Validates that a guess is within the acceptable range (1-101 ).
1010 *
1111 * @param guess the user's guess to validate
1212 * @throws IllegalArgumentException if the guess is less than 1 or greater than 101
Original file line number Diff line number Diff line change @@ -58,6 +58,11 @@ public int compareTo(HighScore other) {
5858 return Integer .compare (this .numberOfGuesses , other .numberOfGuesses );
5959 }
6060
61+ /**
62+ * Returns a string representation of this high score in the format "username: X guess(es)".
63+ *
64+ * @return a formatted string containing the username and number of guesses
65+ */
6166 @ Override
6267 public String toString () {
6368 return username + ": " + numberOfGuesses + " guess" + (numberOfGuesses == 1 ? "" : "es" );
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ public class RandomNumber {
1212 Random random = new Random ();
1313
1414 /**
15- * Generates a random integer between 0 and the specified maximum value (inclusive).
15+ * Generates a random integer between 0 (inclusive) and the specified maximum value (inclusive).
1616 *
17- * @param max the maximum value for the random number
18- * @return a random integer between 0 and max (inclusive)
17+ * @param max the maximum value for the random number (inclusive)
18+ * @return a random integer in the range [0, max]
1919 */
2020 int number (int max ) {
2121
Original file line number Diff line number Diff line change 55import java .io .InputStream ;
66import java .io .InputStreamReader ;
77
8- /**
9- * Reads version information for the Number Guessing Game. Currently returns a placeholder version
10- * string.
11- */
8+ /** Reads version information for the Number Guessing Game from the version.txt resource file. */
129public class ReadVersionFile {
1310 /**
1411 * Retrieves the current version of the game by reading from the version.txt resource file.
1512 *
1613 * @return the version string
1714 */
1815 public String readVersion () {
19- String content = "1.0.0" ; // Placeholder version
16+ String content = "1.0.0" ; // Default fallback version
2017 try (InputStream inputStream =
2118 getClass ().getClassLoader ().getResourceAsStream ("version.txt" );
2219 BufferedReader reader = new BufferedReader (new InputStreamReader (inputStream ))) {
You can’t perform that action at this time.
0 commit comments