##
Class GuessingGame

java.lang.Object
**GuessingGame**

public class **GuessingGame**

- extends java.lang.Object

Class for playing a simple guessing game.

A GuessingGame object picks a random number from a range, and the user can then
make repeated attempts to guess the number. Each guess results in a message as
to whether the guess was correct, too high, or too low. When done, the user can
determine how many guesses it took to get the number, and can choose to play again
with a different number.

**Version:**
- 2/27/08
**Author:**
- Dave Reed

**Constructor Summary** |

**GuessingGame**(int maxNumber)
Constructs a GuessingGame object by selecting a number in the specified range. |

**Method Summary** |

` int` |
**getNumberOfGuesses**()
Accessor method to report the number of guesses made so far. |

` java.lang.String` |
**makeGuess**(int guess)
Takes a user's guess and determines if it is correct, too low, or too high. |

` void` |
**playAgain**(int maxNumber)
Resets the game with a new number and reinitialized statistics. |

**Methods inherited from class java.lang.Object** |

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait` |

###
GuessingGame

public **GuessingGame**(int maxNumber)

- Constructs a GuessingGame object by selecting a number in the specified range.

**Parameters:**`maxNumber`

- the limit of the range the number can be from (1..maxNumber)

###
getNumberOfGuesses

public int **getNumberOfGuesses**()

- Accessor method to report the number of guesses made so far.

**Returns:**- the number of guesses

###
makeGuess

public java.lang.String **makeGuess**(int guess)

- Takes a user's guess and determines if it is correct, too low, or too high.

**Parameters:**`guess`

- the user's guess
**Returns:**- a message specifying whether the guess is correct, too high, or too low

###
playAgain

public void **playAgain**(int maxNumber)

- Resets the game with a new number and reinitialized statistics.

**Parameters:**`maxNumber`

- the limit of the range the new number can be from (1..maxNumber)