Question: Pgm 1 9 . Random Number Guessing Game Write a full program that generates a random integer in the range of 1 through 1 0

Pgm 19. Random Number Guessing Game
Write a full program that generates a random integer in the range of 1 through 100, inclusive; and asks
the user to guess what the number is. If the users guess is higher than the random number, the program
should display Too high, try again. If the users guess is lower than the random number, the program
should display Too low, try again. If the user guesses the number, the application should congratulate
the user and generate a new random number so the game can start over.
Some rules to make life much easier:
1. Do at least 5 numbers per game (less than 5 are trivial).
2. For each number, make at least 4 guesses.
3. Limit the number of guesses to 10 for each number.
Do the following as part of this programming exercise:
1. Keep count of the number of guesses that the user makes for each number.
2. When the user correctly guesses the random number, the program should display the number of
guesses that were needed.
3. Write the number and number of guesses to a new output file for each game.
4. When the user wants to start a totally new game, not a run, close the output file.
Process the output file as a separate program:
1. Read each entry in the file and total the number of guesses for each use.
2. When finished processing, print out the total number of guesses and print out the average
number of guesses for the game.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!