Question: For this assignment you are going to write a C++ program using the requirements below. Write your full name with your student number as a

For this assignment you are going to write a C++ program using the requirements below. Write your full

name with your student number as a block comment /**/ at the beginning of the program (2 marks will

be detected from code without this comment).

Program Requirements

Write a guess game that asks the user to enter an integer number and displays three different

hexadecimal numbers then asks the user to guess which hexadecimal number matches their entered

number.

Your program should include the following:

1- Ask the user to enter a number between 10 and 50.

2- Find the equivalent Hexadecimal number to user entered number.

3- Generate randomly two more numbers one is smaller than the number entered by the user and

one is bigger. These two numbers also are converted to Hexadecimal numbers.

4- Display the three hexadecimal numbers.

5- Prompt the user to guess the correct hexadecimal number.

6- Display a congrats message if the user guesses the answer and sorry message if they did not.

7- Prompt the user if they want to play another game.

Notes:

1- It is possible the user to enter 10 or 50. In this case the program should generate the two

random numbers either both above in case of 10 or both below in case of 50.

2- You should not display the answers in the same orders.

Sample run

Please enter number between 10 and 50: 2

Sorry, your entered number is out of the range.

Please enter number between 10 and 50: 23

Which of the following hexadecimal numbers is equivalent to 23

a- 17

b- 1D

c- F

Enter your answer: b

Sorry, this is not the correct answer. The correct answer is 17

Would you like to play again Y/y for yes and N/n for no? YPlease enter number between 10 and 50: 44

Which of the following hexadecimal numbers is equivalent to 44

a- 30

b- 12

c- 2C

Enter your answer: d

Try again, select a, b or c.

Which of the following hexadecimal numbers is equivalent to 44

a- 30

b- 12

c- 2C

Enter your answer: d

Well done! The correct answer is 2C

Would you like to play again Y/y for yes and N/n for no? n

Assessment

Your program will not be marked if it includes syntax errors. This assignment is out of 100.

- Using meaningful variable names. (5 points)

- Adding enough comments to understand the program. (5 points)

- Using indentation properly. (4 points)

- A function that accepts as parameters two integer numbers. The function generates and returns

a random number between the two accepted numbers. (10 points)

- A function that prompts the user to enter a valid integer number between 10 and 50. The

function should validate the user input. (12 points)

- A function that accepts as a parameter integer number and returns a hexadecimal number as a

string. The function converts integer decimal number to hexadecimal number. Use this link to

learn how to convert decimal to hexadecimal https://www.binaryhexconverter.com/decimal-to

hex-converter (15 points)

- A function that accepts three strings as parameters, the hexadecimal options, and displays these

three hexadecimal numbers on the screen. (12 points)

- A function that asks the user to enter one of the three options then returns the valid selected

option. (12 points)

- A main function that calls the above functions to cover all the assignment requirements. (25

points)

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!