Question: ****** CODE C++ *********** This program will help a young math student practice the four basic operations. This program begins by displaying for the user
****** CODE C++ ***********
This program will help a young math student practice the four basic operations. This program begins by displaying for the user a menu of choices. The choices will be either to create a random problem for one of the four operations or to quit the application. You can see from the example execution log for Math that the menu consists of choices that allow the user to have the program create a problem or quit.
Here are more specific requirements for the different options.
Addition Problems - Both operands should be random numbers in the range, 1 to 500, inclusive. - Use the '+' as the addition operator symbol
Subtraction Problems - Both operands should be random numbers in the range, 1 to 999, inclusive - But the second operand, (the number being subtracted from the top number) should be less than or equal to the first operand This ensures that the answers to subtraction problems are never negative - Use the '-' as the subtraction operator symbol
Multiplication Problems - The first operand (top number) must be in the range of 1 to 100, inclusive. - The second operand (bottom number) must be in the range of 1 to 9, inclusive. - Use the 'X' as the multiplication operator symbol
Division Problems - Display these problems horizontally as: Operand1 / Operand2 = , a.k.a, Dividend / Divisor = - The range for the divisor (operand 2) must be from 1 to 9, inclusive - The dividend (operand 1) must have a value such that the resulting quotient is always in the range of 1 to 50, inclusive
Remember to use named constants (const) for all hard values found in the requirements or implied by them. In this program all of the minimum and maximum range values should be named constants.
When your Math solution executes, here is what it should look like. Of course, your program will select different values for the problems because you properly seeded the random generator, but this example execution log shows you many details about what the program looks like and does as it executes.
*********** Must print out like below: ************
Math Menu ------------------------------ 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program ------------------------------ Enter your choice (1-5): 1 148 + 36 ----- 184 Congratulations! That's right. Math Menu ------------------------------ 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program ------------------------------ Enter your choice (1-5): 2 664 - 385 ----- 279 Congratulations! That's right. Math Menu ------------------------------ 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program ------------------------------ Enter your choice (1-5): 3 56 X 2 ----- 112 Congratulations! That's right. Math Menu ------------------------------ 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program ------------------------------ Enter your choice (1-5): 4 180 / 4 = 45 Congratulations! That's right. Math Menu ------------------------------ 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program ------------------------------ Enter your choice (1-5): 2 435 - 82 ----- 345 Sorry, the correct answer is 353. Math Menu ------------------------------ 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program ------------------------------ Enter your choice (1-5): 0 The valid choices are 1 through 5. Please choose again. Math 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 through 5. Please choose again. Math Menu ------------------------------ 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program ------------------------------ Enter your choice (1-5): 4 140 / 4 = 34 Sorry, the correct answer is 35. Math Menu ------------------------------ 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program ------------------------------ Enter your choice (1-5): 5 Terminating Math... __________________________________ You worked on 6 problems. 1 addition problems 2 subtraction problems 1 multiplication problems 2 division problems You got 4 problems correct! Your percent correct is: 66.67% Thank you for using Math
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
