CSC 160 - Program #3

MathTutor 5000
Assigned: Weds Jan 22, 2003 Pseudo-code due: Mon Jan 27, 2003
Program #3 is worth 50 points

Program due: Weds Jan 29, 2003

Concepts

This program emphasizes the following "new"-ish concepts:

Description

The MathTutor 5000 is a math tutoring program. The menu-driven program randomly generates addition, subtraction and multiplication problems for the user to solve. This program is based on the "Math Tutor" examples in our text found on:
  • Page 311 - Programming Challenge #4 of Chapter 5
  • Page 249 - Programming Challenge #4 of Chapter 4
  • Page 165 - Programming Challenge #11 of Chapter 3

At the beginning of the session, first query the user once for:

  • a random seed for srand(), and
  • the maximum number used during the session, typically 10 or 100. MathTutor will generate numbers between 0 and this maximum when creating math problems.

After that, the MathTutor 5000 menu is displayed and the user is prompted for a choice. Here is an example of this menu:

*************************
* MathTutor 5000
*************************

 1. Addition [A]
 2. Subtraction [S]
 3. Multiplication [M]
 4. Pick-em [P]
 5. Quit [Q]

 Make your selection:

The MathTutor 5000 menu is flexible. The user can select a choice number, or the first letter of any choice. The "Addition", "Subtraction" and "Multiplication" menu choices show the user a math problem of that type. The "Pick-em" menu choice randomly selects the type of problem (+, -, or *).

Once a problem type is selected, MathTutor 5000 randomly generates the two operands for the problem, displays an equation and queries the user for his/her answer. Here's an example of this step (user input is in bold):

                    8
                  + 9
             ________
Your answer? 17
Correct! Nice job.

Or, if the problem is answered incorrectly:

                    9
                  * 9
             ________
Your answer? 87
Sorry. That is incorrect.

After the problem is completed, display the menu again, prompting the user for his/her next action.

If the user makes an invalid selection (like "z" or "9") , then you should issue an error message and then display the menu again.

If the user elects to quit, then end the session with a statistical recap including: the number of problems attempted, the number of problems correctly answered, and a grade. The grade should be based on the standard 90/80/70... scale. Here's an example:

 Make your selection: q

Session report:
        Problems attempted = 3
        Correct answers = 2
        Correct percent = 66%
        Your grade is D

Implementation Notes

Please include the following in your implementation:

  • Use rand() and srand() to generate random numbers.
  • Create an enumerated type (enum) for the types of math problems that MathTutor 500 can handle and use this wherever appropriate in your code.
  • Use <iomanip> functions to do output formatting wherever possible.
  • Use increment and decrement operators (++ and --) where possible.
  • Use at least one switch() statement in your implementation

Grading

Your program will be graded on three areas: design, quality, and function.

Design (20%)

Your design must include detailed pseudo-code (in English, not C++) describing how your program will function. You can use the text and Programs #1 and #2 as your guide. 

Quality (20%)

Your program must include:

Function (60%)

Your program must:

Make sure you run your program with multiple test cases, including cases with invalid input.

To hand your program in, please place two things in the "prog03" folder on your k: drive:

  1. All the files (C++, obj, exe, etc.) associated with your program.
  2. A README.txt file describing any problems you had with this assignment and also the test cases you used to verify that your program was working correctly.

Notes

Any additions to the assignment will be listed below...