Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone Help me Solve Part 3, Please! Part -1 Code #include #include using namespace std; int main() { //declare variables needed int n,m; srand(time(NULL));

Can someone Help me Solve Part 3, Please!

image text in transcribed

image text in transcribed

Part -1

Code

#include  #include  using namespace std; int main() { //declare variables needed int n,m; srand(time(NULL)); //generate random number in range 1 to 500 int min=1,max=500; n = (rand() % (max - min + 1)) + 1; m = (rand() % (max - min + 1)) + 1; cout 

Part -2

Code

#include  #include  using namespace std; int main() { //declare variables needed int n,m,temp; srand(time(NULL)); //generate random number in range 1 to 500 int min=1,max=500; n = (rand() % (max - min + 1)) + 1; m = (rand() % (max - min + 1)) + 1; cout>temp; // cout 

An Example of Test Runs The output of your program might look like this: csci>a.out 339 + 259 Enter your answer: 588 this number is user's input Sorry. The correct answer is 598. csci>a.out 339 + 259 Enter your answer: 598 this number is user's input Congratulations! That's the correct answer. Task3 (30 points) Modify the program again so it displays a menu allowing the user to select an addition, subtraction, multiplication, or division problem. The final selection on the menu should let the user quit the program. After the user has finished the math problem, the program should display the menu again. The process is repeated until 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. Additional requirements for the range of two random numbers to be generated In the case of subtraction, make sure the second number is smaller or equal to the first one using a while loop to validate. In the case of multiplication, make the first number in the range of 1 ~ 100 and the second number in the range of 19. single digit divisor ( 1 ~9) and a number that is a multiple of the divisor. For example, num = divisor * (rand(% 50 +1) Input An option from the displayed menu and a number for the solution output The program will first display a menu and prompt the user to enter a choice from the menu. The program then will display two random numbers to be computed and prompt the user to enter an answer for the result of these two numbers and display a message according to user's answer. This process will be repeated until the user's choice is to quit. An Example of Test Runs The output of your program might look like this: 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 104 73 + 288 Sorry, the correct answer is 177

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

LO1 Summarize the organizations strategic planning process.

Answered: 1 week ago