View the step-by-step solution to:

my task is to develop a program that will teach youngsters the basic math facts of addition, subtraction, multiplication and division.

my 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. Players 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 player 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. 

 


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

 

Requirments:

  1. Generate simple math fact problems:
  2. Addition (the total must be an integer >= 0)
  3. Subtraction (the difference must be an integer >= 0)
  4. Multiplication (the product must be an integer >= 0)
  5. Division (the quotient must be an integer >= 0)
  6. 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!
  7. The program should keep track of the following statistics:
  8. The user's name
  9. The total correct answers
  10. The total wrong answers
  11. The total earnings ($0.05 is awarded for every correct response and $0.03 is subtracted from every incorrect response)
  12. A separate text file must be created for every user:
  13. Statistics are read from the file at the start of the game (if the user is a returning player).
  14. Statistics are recorded at the end of every game.

  1. My 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 can add your own functions if you like:
  2. credits //This function is used to display your name and what the program does
  3. menu // This function is used to display the menu with various options
  4. validateUserResponse // This function is used to validate user input from the menu
  5. validateUserAnswer // This function is used to validate user input and ensure that ONLY numeric answers are entered by the user.
  6. checkUserAnswer // given a math problem, this function is used to check if the answer the user entered is correct or incorrect
  7. updateStats // This function is used to keep a running total of game statistics (in RAM)
  8. displayStats // This function is used to display statistics on screen
  9. 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 make text file to store the stats.
  10. saveStats // This function is used to save player statistics on an external txt file.
  11. 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.
  12. You must use meaningful variable names.
  13. You must comment your code.
  14. You must use variables of the correct type nd initialize them with a proper value.

 

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question