Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

%%% C ++ ( not java) %%% TheMathGame: Your task is to develop a program that will teach youngsters the basic math facts of addition,

%%% C ++ ( not java) %%%

TheMathGame:

Your task is to develop a program that will teach youngsters the basic math facts of addition, subtraction, multiplication and division. The program generates random math problems for students to answer. Students get a small reward for correct answers and suffer a small penalty for incorrect ones. User statistics need to be recorded in a text file so that they me loaded back into the program when the student returns to play the game again. In addition, the youngster should be allowed to see how (s)he is doing at any time while (s)he is playing the game. One of the MAJOR objectives of this assessment is for you to demonstrate your ability to use functions and employ reference and value parameters.

WARNING:

If you do not employ functions which use reference and value parameters you will NOT pass the midterm.

You should also note that your main() function should consist of mostly function calls and not be greater than 100 lines in total; however, your entire program will be closer to 500 - 800 lines of code!

PROGRAM REQUIREMENTS

1. Generate simple math fact problems:

1. Addition (the total must be an integer >= 0)

2. Subtraction (the difference must be an integer >= 0)

3. Multiplication (the product must be an integer >= 0)

4. Division (the quotient must be an integer >= 0)

2. Validate user input at every opportunity. If your program crashes because you allow the user to make an invalid entry and you did not write code to handle such potential exceptions, you will NOT pass the midterm!

3. The program should keep track of the following statistics:

1. The users name

2. The total correct answers

3. The total wrong answers

4. The total earnings ($0.05 is awarded for every correct response and $0.03 is subtracted from every incorrect response)

4. A separate text file must be created for every user:

1. Statistics are read from the file at the start of the game (if the user is a returning player).

2. Statistics are recorded at the end of every game.

5. The program must be developed using functions so that the main() function consists mostly of function calls. Below is a list of most of the required functions, you may add your own functions if you like, just remember that If you do not employ functions which use reference and value parameters you will NOT pass:

1. credits //This function is used to display your name and what the program does

2. menu // This function is used to display the menu with various options

3. validateUserResponse // This function is used to validate user input from the menu

4. validateUserAnswer // This function is used to validate user input and ensure that ONLY numeric answers are entered by the user.

5. checkUserAnswer // given a math problem, this function is used to check if the answer the user entered is correct or incorrect

6. updateStats // This function is used to keep a running total of game statistics (in RAM)

7. displayStats // This function is used to display statistics on screen

8. retireveStats // This function is used to retrieve player statistics from external txt file when the game starts, assuming the player is a returning player, else create a text file to store the stats.

9. saveStats // This function is used to save player statistics on an external txt file.

10. You may also want to consider the following four functions: generateAddition, generateSubtraction, generateMultiplication and generateDivision // use these to generate a problem of the appropriate type.

6. All functions must be correctly prototyped.

7. All functions must be correctly defined.

8. You must use meaningful variable names.

9. You must comment your code.

10. You must use variables of the correct type and initialize them with a proper value.

GENERAL RESTRICTIONS FOR ALL QUIZZES, MIDTERM AND FINAL EXAM

1. No global variables

2. No infinite loops, examples include:

1. for(;;)

2. while(1)

3. while(true)

4. do{//code}while(1);

3. No break statements to exit loops

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

1. Which is the most abundant gas presented in the atmosphere?

Answered: 1 week ago

Question

Define and measure service productivity.

Answered: 1 week ago