CSCI 240 -- Assignment 2 -- Spring 2007
Due: Monday, February 5, 3 pm
Points: 100
For this assignment, you will write a program that will allow you to calculate your course average at any point in the semester, assuming you know your scores.
First, display an informative title and brief instructions for the user.
Next, prompt the user to enter his or her various scores and get them (all input should be as integers).
1. Ask for the user's total program points (so far in the course) and accept
it.
2. Ask for the maximum possible program points (so far) and accept it.
3. Ask for the user's quiz average (so far) and accept it.
4. Ask for the user's total test points (so far) and accept it (0 if
none)
5. Ask for the maximum possible test points (so far) and accept it (0
if none).
We assume that when the user runs the program there will be some program points and there will be a quiz average, but there might not be any test points yet.
When prompting the user, give good instructions, such as:
Enter the the total test points so far (0 if no tests yet):
Now do the various calculations. Be careful to avoid integer division truncation - for example, 20/30 is 0. Use typecasts to (double) where necessary.
The calculations are done as follows:
1. A program average is calculated as total pgm points so far / max possible pgm points so far * 100. Your program may assume there is at least one program score.
2. Your program may assume there is a non-zero quiz average.
3. An overall test average is calculated as follows (the calculation includes quiz scores):
a. if the the maximum possible test points is not 0 use:
(total test pts + quiz average) / (max possible test points + 100) * 100
b. if the maximum possible test points is 0 use just the quiz average.
4. The course average is then the weighted average of program average and overall test average, with overall tests weighted at 60% and programs weighted at 40%. For example, if your overall test average is 80 and your program average is 90, your overall course average is 84.
However, if the overall test average is less than 55, then set the course average to -1 (a failing grade).
Finally, display, with appropriate labels, one per line, the
Print these averages using 2 decimal places to the right of the decimal point. Use spaces in your couts to help line up the numeric results in a column. If there are no test points, print a message instead of a calculated test average.
Include documentation similar to that in Assignment 1, and format your code carefully, indenting the body of decisions and including some blank lines to separate parts of the program (the input part, the calculation part, and the output part, at least). Points will be deducted if there is little or no effort to do this.
Hand in your source code printout, and submit the program electronically via the web.