Question: the pseudo code for the program Write a program that displays a menu allowing the user to select addition, subtraction, multiplication, or division problem. The












Write a program that displays a menu allowing the user to select addition, subtraction, multiplication, or division problem. The program should wait for the students to enter the answer. If the answer is correct, a message of congratulations should be printed. If the answer is incorrect, a message should be printed showing the correct answer. After the user has finished the math problem, the program should display the menu again. This process is repeated until the user chooses to quit the program. Input Validation: If the user selects an item, not on the menu, display an error message and display the menu again. Requirements: For each problem generate a random number in the range 1-9 Addition Generate two random numbers in the range 1 - 9. Subtraction Generate two random numbers in the range 1 - 9. Make sure the second number is less than or equal to the first number. If it is not, then generate the second number again until the second number is less than the first number (Use a while loop) Multiplication Generate two random numbers in the range 1 - 9. DIVISION Generate two random numbers in the range 1 - 9. Generate the second number as a divisor Generate the first number as a dividend. The first number is a multiple of the second number. Output sample: Math Tutor Menu 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program Enter your choice (1-5): 1 6 + 4 10 Congratulations! That's right. Math Tutor Menu 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program Enter your choice (1-5): 2 5 4 4 11 Sorry, the correct answer is 1. Math Tutor Menu 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program Enter your choice (1-5): 3 ON * 18 Congratulations! That's right. Math Tutor Menu 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program Enter your choice (1-5): 4 12/2 = 5 Sorry, the correct answer is 6. Math Tutor Menu 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program Enter your choice (1-5): 6 The valid choices are 1, 2, 3, 4, and 5. Please choose: 1 Enter your choice (1-5): 6 The valid choices are 1, 2, 3, 4, and 5. Please choose: 1 4 + 9 13 Congratulations! That's right. Math Tutor Menu 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program Enter your choice (1-5): 5 Thank you for using Math Tutor. Partial coding: // Chapter 5, Programming Challenge 8: Math Tutor #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
