Java is the future !: GuessGame Program

Monday, August 9, 2010

GuessGame Program

Summary: 

The guessing game involves a 'game' object and three 'player' objects. The game generates a random number between 0 and 9 and the three player objects try to guess it.

Classes:

GuessGame.class   Player.class   GameLauncher.class

Logic:

1) The GameLauncher class is where the application starts; it has the main() method.
2) In the main() method, a GuessGame object is created, and its startGame() method is called.
3) The GuessGame object's startGame() method is where the entire game plays out. It creates three players, then "thinks" of a random number (the target for the players to guess). It then asks each player to guess, checks the result, and either prints out information about the winning player(s) or asks them to guess again.

You can download the source code of the program from the link given below.

No comments:

Post a Comment