Question: PROGRAM DESCRIPTION In this project, you have to write a C + + program to design a game that involves guessing a number between two

PROGRAM DESCRIPTION
In this project, you have to write a C++ program to design a game that involves guessing a number
between two randomly generated numbers. You cannot see the randomly generated at start. If you guess
correctly, you earn points. If you guess incorrectly, you lose points. You can keep on guessing as long as
you have points remaining. You can also choose to display one of the two numbers (either the lower
bound or the upper bound) to make the game easier. If you choose to display a number to get help, you
earn less points for correct guesses and lose more points for incorrect guesses. You CANNOT, of course,
display both bounds. If you COULD display both, there will be no guessing.
DO NOT USE ARRAYS AND PROGRAMMER DEFINED FUNCTIONS IN YOUR PROGRAM. IF YOU DO SO,
YOU WILL GET A ZERO. WE WILL LEARN ABOUT THOSE IN CHAPTERS 5 AND 6 LATER.
Note that a player can cheat in this game by repeatedly entering a correct guess. But we will ignore that
scenario for this project.
PROGRAM REQUIREMENTS
1. As with all projects in this course, your programs output will display your name, your EUID, your
e-mail address, the department name, and course number. This means that your program will
print this information to the terminal (see the sample output).
2. Declare an integer variable and initialize it to 100. This variable represents the number of points
each player starts the game with.
3. Declare an enumeration constant with values DisplayLeft, DisplayRight, Guess,
Change and Exit (in order) and assign integer values 1 to 5 to them respectively. These five
items will correspond to the menu choice you will provide the player.
4. Using a suitable message, ask the player for the name of the player. The name may have multiple
words.
Only alphabets (A-Z or a-z) and whitespaces are permitted in the account name.
o If the player enters any other characters in the name, you need to generate an
error message and ask for the name again.
o Your program must keep on asking the player to enter the name until the player
enters it correctly.
The player may type the name in either uppercase or lowercase, but you need to convert
every initial to uppercase and every other alphabet to lowercase.
If the players name contains either Senior or Junior at the end as suffix, then convert to
that suffix into shortcut Sr. or Jr. Also add comma before Sr. and Jr.
o For example, Bill Gates Senior should be Bill Gates, Sr. and Bill Gates Junior
should be Bill Gates, Jr.(without quotes)
Show suitable welcome message if valid name of the player is entered.Generate two seeded random integers in the range of 150 to 250, inclusive. The first integer MUST
BE less than the second integer. Using a loop of choice, keep on generating the integers until it is
so.
Declare two integers and initialize them with -1 and display them. Since you cannot display the
actual numbers being randomly generated, you will only display these integers. In case the player
wants to see the randomly generated integer, you will replace one of the -1 with the actual
random number being generated.
Based on the enumerated constant data of Step 3, generate menu choice for the player. Using an
integer variable, ask the player to select from the menu. See Sample Output.
Design a switch-case block with a default case, use the enumerated data constants of Step 3 as
your cases. Based on the player input of Step 7, one of the cases will be executed.
You must use a variable of your enumeration constant type as the switching expression.
If the player chooses to display the integer on the left (the lower bound), display the first
randomly generated integer instead of -1 on the left.
Provide a message saying a correct guess will only earn 1 point and an incorrect
guess will lose 10 points in the game.
If the player chooses to display the integer on the right (the upper bound), display the
second randomly generated integer instead of -1 on the right.
Provide a message saying a correct guess will only earn 1 point and an incorrect
guess will lose 10 points in the game.
In both cases, make sure the player cannot display both numbers/bounds.
If the player chooses to guess a number between the two bounds, ask the player to enter
the guess.
If the guessed number is between the two bounds (i.e., the player guesses
correctly), increase the points, otherwise decrease the points.
If the player has displayed either of the two bounds, you need to increment by 1
point and decrement by 10 points, when appropriate.
If the player has NOT displayed any of the two bounds, you need to increment by
5 points and decrement by 5 points, when appropriate.
Update the player with the points balance after every guess.
Note that the guess can be the two bounds, i.e., inclusive. For example, if the
generated numbers are 150 and 160, both 150 and 160 are correct guesses.
If the player chooses to change the random numbers, regenerate the two seeded random
numbers, still making the first numbe
 PROGRAM DESCRIPTION In this project, you have to write a C++

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 Databases Questions!