Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This week we looked at an example math program that would display the answer to a random math problem. Enhance this assignment to prompt the

This week we looked at an example math program that would display the answer to a random math problem. Enhance this assignment to prompt the user to enter the solution to the displayed problem. After the user has entered their answer, the program should display a message indicating if the answer is correct or incorrect. If the answer is incorrect, it should display the correct answer. The division section should use Real data types instead of Integer data types. Keep track of how many correct/incorrect answers the user makes during the program and when they choose to exit, the program should display the percentage they got correct (# of correct / total # attempted).

HINT: Keep in mind you will need to add 1 or more additional parameters to the addition, subtraction, multiplication, and division methods to support the ability to track the total attempted and total correct. Also, be aware with the way Real numbers are stored in memory, it will be nearly impossible for you to get a division problem correct. You don't need to worry about adjusting for this in your program, I just want to make you aware of this in case you run into this issue while testing your program. Let me know if you have questions or would like to discuss this further.

Example Output: 1) Addition 2) Subtraction 3) Multiplication 4) Division 5) Exit Enter your selection: 1[Enter] 12 + 34 = 45 [Enter] Im sorry, the correct answer was 46

1) Addition 2) Subtraction 3) Multiplication 4) Division 5) Exit Enter your selection: 2[Enter] 45 2 = 43[Enter] Yes, that is the correct answer!

1) Addition 2) Subtraction 3) Multiplication 4) Division 5) Exit Enter your selection: 5 [Enter] Thanks for playing. You answered 1 out of 2 questions correct for a score of 50%

IMPORTANT:

PROGRAM MUST BE RAPTOR IN INTERMEDIATE MODE.

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

Step: 3

blur-text-image

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

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

Students also viewed these Databases questions