This week we looked at an example math program that would display the answer to
ID: 3726426 • Letter: T
Question
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).
( flow charts in raptor??)
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,.
Example Output:
1) Addition
2) Subtraction
3) Multiplication
4) Division
5) Exit
Enter your selection:
1[Enter]
12 + 34 =
45 [Enter]
I’m 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%
Explanation / Answer
->You didn't provide any language prefrence so, I write solution in python
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.