Question
USE C++ Homework 6 = Your programs should include appropriate comments and should follow the program documentation requirements listed in the syllabus. (40 points) Write
USE C++
Homework 6
=
Your programs should include appropriate comments and should follow the program documentation requirements listed in the syllabus.
(40 points) Write a program that will help an elementary school student learn math. The program should ask the user to pick a type of arithmetic problem to study.Option 1 means addition problems, 2 means subtraction problems, 3 means multiplication problems, and 4 means division problems. If user picks 5,
program should randomly pick one of the options 1-4 and entering 6 should end the program. The program should also allow the user to enter a difficulty level. At a difficulty level 1, the program should use only single-digit numbers in the problems, at a difficulty level 2, numbers as large as two digits, and so on.
The program should prompt the user with a question, such as
How much is 6 times 7?
The student then inputs the answer. If the answer is correct, program displays one of the following messages:
Very good!
Excellent!
Nice work!
Keep up the good work!
(Use rand () function to choose a number from 1 to 4 that will be used to select one of the four messages to each correct answer)
If the answer is wrong, program displays one of the following messages:
No, please try again.
Wrong, try once more.
Dont give up!
No, keep trying.
(Use rand () function to choose a number from 1 to 4 that will be used to select one of the four messages to each incorrect answer)
Let the student try the same question repeatedly until the student gets it right.
Your program should have at least four functions: one to display the menu, one to generate questions, one function randomly chooses response to correct answer, and one function randomly chooses response to incorrect answer.
Do not use global variables. Be sure the user only selects 1- 6 when selecting an item from the menu.
Sample run:
Math Menu
-------------------------------------------
Enter 1 for addition problem
Enter 2 for subtraction problem
Enter 3 for multiplication problem
Enter 4 for division problem
Enter 5 for a combination of 1 through 4
Enter 6 to quit this program
----------------------------------------------
Enter your choice (1-6): 1
Enter difficulty level: 2
How much is 83 plus 27? 100
No. Please try again.
? 102
No. Keep trying.
? 110
Very good!
Math Menu
-------------------------------------------------
Enter 1 for addition problem
Enter 2 for subtraction problem
Enter 3 for multiplication problem
Enter 4 for division problem
Enter 5 for a combination of 1 through 4
Enter 6 to quit this program
-------------------------------------------------
Enter your choice (1-6): 5
Enter difficulty level: 1
How much is 5 minus 3? 2
Excellent!
Math Menu
--------------------------------------------------
Enter 1 for addition problem
Enter 2 for subtraction problem
Enter 3 for multiplication problem
Enter 4 for division problem
Enter 5 for a combination of 1 through 4
Enter 6 to quit this program
------------------------------------------------------
Enter your choice (1-6): 6
Thank you for using Math.
Submission Instruction:
Submit your source files via Canvas by the beginning of the class on March 21, 2017.
You only need to submit your source code les (.cpp).
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