CSCI240 Program 3 Decision Statements grade calculator solution

$25.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

For this assignment, expand (again) on the CSCI 240 grade calculator from programs 1 and 2. This time the program will still focus on the test average, but eliminate the assumption that the user has taken at least two quizzes.

Basic Program Logic

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

As with program 2, get the sum of the user’s test scores, the maximum test points available, the number of quizzes that the user has taken, and the sum of all of the user’s quiz scores.

If the user has taken more than two quizzes, then they should be prompted to enter the sum of the two lowest quiz scores. If there are two or fewer quizzes, nothing should be asked about the two lowest quiz scores.

If the user has taken more than two quizzes, the test average is calculated as in Program 2. If there are two or fewer quizzes, the test average is calculated as follows:

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

Once the test average has been calculated, use it and the program average to calculate the course average. The formula is the same as in programs 1 and 2.

As with program 2, display the program average, test average, and course average 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 programs 1 and 2. This will be a part of every program that is submitted during the semester and this will be the last reminder in the program write-ups.
  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 also be a part of every program that is submitted for the remainder of the semester.
  3. The float/double values must be displayed with exactly 2 digits after the decimal point.
  4. Make sure and test your program with values that you have calculated.
  5. Hand in a copy of your source code (the CPP file) using Blackboard.

Output

A couple of runs of the program should resemble the following:

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: 2
Enter the sum of all of the quizzes that have been taken: 17

***********************
Grade Calculator

Program Average     75.26
Test/Quiz Average   77.50

Course Average      76.83
***********************

Run 2

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

***********************
Grade Calculator

Program Average     75.26
Test/Quiz Average   80.77

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

Extra Credit 1

For up to 5 points of extra credit, add code that will use the calculated course average to determine and display the user’s letter grade. The grading scale is as follows:

A: 90.00% – 100%
B: 80.00% – 89.99%
C: 70.00% – 79.99%
D: 60.00% – 69.99%
F: 0.00% – 59.99%

Also, if attempting the extra credit, add a cout statement at the beginning of the program that displays something like “EXTRA CREDIT 1 ATTEMPTED” at the beginning of the output.

Note about extra credit: the points will ONLY be awarded if the required portions of the assignment work correctly. In other words, don’t take short cuts in the rest of the program because it is assumed that 5 extra points will be awarded.

Extra Credit 1 Output

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

***********************
Grade Calculator

Program Average     94.52
Test/Quiz Average  100.00

Course Average      98.36

Grade: A
***********************

Extra Credit 2

For up to an additional 5 points of extra credit, add code that will take into account the special rule about having to pass both parts of the course. A student must achieve a test average and a program average of at least 55% to pass the course. If a student receives less than 55% for either part of the course, display a letter grade of F and a brief explanation as to why that grade was earned. Otherwise, the letter grade should be displayed like normal.

Also, if attempting the second extra credit, modify the cout statement at the beginning of the program so that it displays something like “EXTRA CREDIT 1 and 2 ATTEMPTED” at the beginning of the output.

Note about extra credit 2: Extra Credit 1 must be successfully completed to earn these points.

Extra Credit 2 Output

Enter the program average: 25.41

Enter the sum of the test scores: 334.5
Enter the maximum test points available: 400

Enter the number of quizzes that have been taken: 12
Enter the sum of all of the quizzes that have been taken: 64
Enter the sum of the two lowest quiz scores: 0

***********************
Grade Calculator

Program Average     25.41
Test/Quiz Average   79.70

Course Average      63.41

Grade: F - the program or test average is below 55%
***********************