Assignment 3: Teacher's Helper

We have the following goal: we want to design a program that can assist a teacher with finding averages and computing scores for exams. The program should contain a menu, where the user can choose among 3 different options, as well as an additional option to quit the program.

For example, the menu might look similar to the following:

Teacher's Helper - Finding Averages
-----------------------------------

[1] Compute Averages
[2] Compute weighted Averages
[3] Total exam scores

[0] Exit program

Specifically, the three choices should accomplish the following:

Compute Average

When this choice is picked, the computer should compute the average of any amount of numbers. You could accomplish this in two ways:

Method 1:
You first ask the user how many numbers will be entered. Then you successively ask for all those numbers, and keep a running total. When all numbers have been entered, your program should display the average.
Method 2:
The user can continue to enter new numbers for the average. When the user enters a specific number (such as -1, for example), the program would stop asking for new numbers and instead compute and display the average of all numbers entered so far.

While I would prefer the second approach, you are free to design your program according to either method.

Compute Weighted Averages

This time, you should ask the user first as to how many number to average. Then, you should ask for a pair of numbers. The first one is a weight (number between 0 and 1) of the score, and the second one is the score itself. When the user has entered the appropriate amount of numbers, the computer should compute the weighted average and display the answer.

For example, I might have 3 scores, one for the exams, one for the homeworks, and one for the quizzes for all students. The scores, in order, are 89, 75, and 66. I want to give the exams 50% weight, and either of the other two should get 25% each.

The formula to compute the weighted average would be:

wAverage = weight1 * score1 + weight2 * score2 + weight3 * score3

where

weight1 = 0.5 and score1 = 89
weight2 = 0.25 and score2 = 75
weight3 = 0.25 and score3 = 66

For extra credit, your program could display a warning message if the weights do not add up to one. Or, again for extra credit, do this part of the program so that the number for the weight *must* be between 0 and 1 always....

Total Exam Scores

This time, I want the program to accomplish the following: my exams are usually copied on 3 or 4 pages. I write down the total amount of points for one page at the bottom corner of each page. I want this program to first ask me how many exams are to be added, and then how many pages each exam has. Then, for each exam, the computer should ask for a number. After entering one number per page, the computer should display the total sum for that exam, then move on to the next exam. When all exams have been entered and totaled, the computer should also give me the average of all exam scores.

For example, if I had 10 exams, each with three pages, the computer should ask questions like:

Enter number of exams: 10
Enter number of pages: 3
Enter exam 1 information:
Please enter page 1: 15
Please enter page 2: 25
Pplease enter page 3: 40
Total for this exam: 80
Enter exam 2 information:
Please enter page 1: 33
Please enter page 2: 22
Please enter page 3: 11
Total for this exam: 66

And so forth, until all information for the 10 exams has been added. After that, the computer should compute and display the average for all exams.

About the Menu System

As discussed in class, you could - as a suggestion - create the following functions to get the menu system to work properly:

void DisplayMenu(void)
Displays the menu, and only the menu, on the screen. In other words, this function will contain only cout statements, nothing else.
char GetUserChoice(void)
This function will as the user to enter a character from the keyboard. That character entered will be returned.
void ClearTheScreen(void)
Will clear the screen (by cout 25 new-line characters)
void WaitForReturn(void)
simply waits for the user to enter a character, together with pressing the RETURN key
void PerformAction(char choice)
This actually peforms the appropriate action. It requires the functions doChoice1, doChoice2 etc to be defined first.
void doChoice1(void)
This is where the actual work to accomplish the first task should go.
void doChoice2(void)
This is where the actual work to accomplish the second task should go.
void doChoice3(void)
This is where the actual work to accomplish the third task should go. and of course int main void.

Remember, we have already desgined - more or less - the strategy for making the menus work. What remains to do is to create these three functions (or subtasks) doChoice1, doChoice2, and doChoice3. Keep in mind that these functions, if necessary, can again call on other functions that you may have defined earlier.

If you have any question, please contact me right ayay. Thanks, good luck, and have fun ...

(bgw)