# CSCI240 Program 2 Formatted Output solution

\$25.00

Category:

## Description

For this assignment, expand on the CSCI 240 grade calculator from program 1. Instead of asking the user to enter the test average, this program will calculate that average.

# Basic Program Logic

As with program 1, prompt the user for the program average and save that value in a double/float variable.

To calculate the test average, the user will be asked to enter 5 pieces of information. This means that 5 variables will need to be added to the program. The user should be asked for:

• the sum of the user’s test scores (double or float)
• the maximum test points available (double or float)
• the number of quizzes that the user has taken (integer)
• the sum of all of the user’s quiz scores (integer)
• the sum of the user’s two lowest quiz scores (integer)

After all the information has been entered, use the new information to calculate the user’s test average as follows (NOTE: the formula is long. Make sure you’re getting the entire formula):

`(sum of test scores + sum of quiz scores - sum of 2 lowest quiz scores) / (maximum test points available + (10 * (number of quizzes - 2))) * 100`

Note: For this assignment, it is safe to assume that the maximum test points available will not be 0 and that the user has taken more than 2 quizzes.

Use the program average and calculated test average to calculate the course average for the user. The formula is the same as in program 1.

As with program 1, display the program average, test average, and course average. However, for this assignment, all of the averages MUST be displayed with exactly 2 digits after the decimal point.

# Program Requirements

1. At the top of your C++ source code, include a documentation box that resembles the one from program 1. Make sure the Date Due and Purpose are updated to reflect the current program.
2. Include line documentation. There is no need to document every single line, but logical “chunks” of code should be preceded by a line or two that describes what the “chunk” of code does. This will be a part of every program that is submitted for the remainder of the semester.
3. As mentioned above, the averages should all be displayed with exactly 2 digits after the decimal point.
4. The program average, sum of the user’s test scores, maximum test points available, calculated test average, and calculated course average should be type float or double. The number of quizzes, sum of all of the user’s quiz scores, and sum of the user’s two lowest quiz scores should be type integer. Make sure to use meaningful variable names.
5. Make sure and test your program with values that you have calculated.
6. Hand in a copy of your source code using Blackboard.

# Output

A few runs of the program should produce the following results:

## Run 1

```Enter the program average: 75.26

Enter the sum of the test scores: 76
Enter the maximum test points available: 100

Enter the number of quizzes that have been taken: 5
Enter the sum of all of the quizzes that have been taken: 42
Enter the sum of the two lowest quiz scores: 13

***********************

Program Average   75.26
Test Average      80.77

Course Average    79.12
***********************
```

## Run 2

```Enter the program average: 100

Enter the sum of the test scores: 100
Enter the maximum test points available: 100

Enter the number of quizzes that have been taken: 5
Enter the sum of all of the quizzes that have been taken: 50
Enter the sum of the two lowest quiz scores: 20

***********************

Program Average  100.00
Test Average     100.00

Course Average   100.00
***********************
```

## Run 3

```Enter the program average: 94.52

Enter the sum of the test scores: 100
Enter the maximum test points available: 100

Enter the number of quizzes that have been taken: 5
Enter the sum of all of the quizzes that have been taken: 50
Enter the sum of the two lowest quiz scores: 20

***********************