Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer in C++! 1. As with all projects in this course, yeur peceram's oulput will displary your name, your EuiD, your e-mail address, the

please answer in C++!
image text in transcribed
image text in transcribed
1. As with all projects in this course, yeur peceram's oulput will displary your name, your EuiD, your e-mail address, the department name, and course number. This means that your program wil print this information to the terminal (see the sample cutput). 2. Declare an inseger variable and initilize it to 100 . This variable represents the number of poists each player starts the game with. 3. Declare an erumeration constant with values displayteft, displaypight, Guess. Change and Exit fin 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-t) and whitespaces are permitted in the acceunt name. Q. If the player enters any other characters in the name, you need to generate an error message and ask for the name again. - Your program must beep on anking the ployer to enter the name unsil the player enters it cortectly. - The player may type the name in either uppercase or lowercase, but you need to convert. every inital to uppercase and every other alphabet to lowercase. 5. Generate two seved randem integers in the range of 100 to 200 , inclusive. The first ingeger MusT be less than the second integer. Using a loop of choice, keep on generating the integers antil it is 30. 6. Declare two integers and initialize them with -1 and diplay them. Since you cannot dbplay the actual numbers being randomly generated, you will anly display shese integers. ln case, the player wants to see the randomly generated integer, you will replace one of the 1 with the actual random number being generated. 7. Based on the enumerated constant data of Step 3, generate methu choice for the plaver. Using an integer variable, ask the player to select from the menu. See sample Output. 8. Design a switch-case block with a detbult case, use the enumerated data constants of Steg 3 as your cases, based on the player input of 5 ep 7 , ane af the cases wit execute. - You must use a variable of your enumeration constant type as the vwitching expresvion. - If the plaver choores to display the integer on the left (the lower bound), display the first randomly generated integer instead of 1 on the left. o Provide a message saving a coerect guess will only earn 1 point and an incerrect guess will lose 10 points in the game. - If the player chooses to display the inseger on the right (the upper bound), display the second randamly generated integer instead of 1 on the right. o Provide a message saving a cocrect guess will oolly eams 1 point and an incorrect guess will lose 10 points in the game. - In both cases, make sure the player cannot display both numbershounds. - If the player chooses to gaess a number between the two bounds, ask the player to enter the guess. o If the gueised number is between the two bounds fi.e. the player guess correctlyl. increment the points, otherwise decrement the points. o If the player has displayed either of the two bounds, you need to increment by 1 point and decrement by 10 points, when appropriate. o tf the player has Not displayed any of the two bounds, you need to increment by S points and decrement by 5 points, when appropriate. o Update the player with the points balance after every guess. o Note that the cuess CANNOT be the two bounds, it has to be strictly between the bounds to be a correct guess. For esample, if the generated numbers are 150 and bounds to be a correct guess. For example, if the generated numbers are 150 and 160 , both 150 and 160 are incorrect guesses. - If the player chooses to change the random numbers, regenerate the two seeded random numbers, still making the first number smaller than second number. Deduct 1 point for this choice and provide the player updated points balance. - If the player choose to Exit, display a suitable goodbye message using the name of the player and display the final points balance. - If the player enters a wrong choice, use the default case to provide an error message and ask the player to enter again. 9. You must use a suitable loop of choice to allow the player to repeat Steps 7 and 8 i.e. choosing from the menu and executing the corresponding case, until the use chooses to Exit or the points balance falls below zero (becomes negative)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago