Question
This program is designed to practice random number generation within a range, nested logic, if/else statements and the switch statement. make a program that can
This program is designed to practice random number generation within a range, nested logic, if/else statements and the switch statement.
make a program that can be used as a math tutor for a young student. code the solution for Addition, Subtraction, Multiplication and Quit. (Division will be coded in a later assignment and utilize loops to ensure there is no remainder.)
Show the user a menu and ask the user to enter a number 1 through 5
- Addition
- Subtraction
- Multiplication
- Division
- Quit
Ask the user to enter a choice from the menu.
Use a switch statement to branch depending on the user's choice. For now, develop a solution for addition, subtraction and multiplication.Test and debug the solution.
For Addition:
The program should display two random numbers that are to be added, such as:
247
+21
The program should wait for the student 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. Assume the top number is between 100 and 999. The bottom number is between 10 and 99.
For Subtraction:
The program should display two random numbers that are to be subtracted, such as:
45
-2
The program should wait for the student 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. Assume the top number is between 10 and 99. The bottom number is between 1 and 9.
For Multiplication:
The program should display two random numbers that are to be multiplied, such as:
11
x4
The program should wait for the student 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. Assume the top number and the bottom number are between 1 and 12.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started