Assignment 4 - Student Grades
Due October 21st
The
purpose of this assignment is to give you practice using if, if ...
else, and switch statements and more practice formatting output.
This assignment should not be too difficult, so there will be
emphasis on following the program requirements.
You
are to write a program that calculates student grades following the
rules for our class (not counting any extra credit).
- 400 points total
- 11 assignments, 20 points each, discard the
lowest score.
- midterms - 50 points possible
- final - 100 points possible
- Lab Exercises - 50 points possible
- 90-100% = A, 80-89% = B, 70-79% = C, 60-69% = D, less than
60% = F
- A
"+" will be added to the grade if it's 100%, 99%, 98%, 89%, 88%, 79%,
78%, 69%, or 68% (assuming points are rounded to the nearest percent).
- A "-" will be added to the grade if it's 91%, 90%, 81%,
80%, 71%, 70%, 61%, or 60%.
- A grade less than 60% will not receive a plus or minus.
Program
requirements
- Declare at least 19 variables.
- Use type unsigned short for variables that are used to hold
point values.
- Use a named constant for the maximum points available, 400.
- Match
the output shown below.
- Use a switch statement to determine the letter grade.
- Use a manipulator to print the assignment grades using a
width of 4.
- The percent
of total should be rounded to the nearest percent.
- After printing the letter grade, and the plus or minus, if
applicable, print one of the following messages.
- if the grade is an A, print "Excellent work"
- if the grade is a B or C, print "Not bad!"
- if the grade is D or F, print "You better try again"
- Your program will be run using one of the following test cases.
Test Case #1
Enter assignment 1 points 19
Enter assignment 2 points 18
Enter assignment 3 points 17
Enter assignment 4 points 16
Enter assignment 5 points 20
Enter assignment 6 points 19
Enter assignment 7 points 20
Enter assignment 8 points 20
Enter assignment 9 points 18
Enter assignment 10 points 19
Enter assignment 11 points 20
Enter lab exercise points 46
Enter midterm points 47
Enter final points 90
Assignment Grades: 19 18 17 16 20 19 20 20 18 19 20
Assignment Points: 190
Lab Exercise: 46
Midterm: 47
Final: 90
Total Points: 373
Percent of total: 93%
Grade: A
Excellent work
Test Case #2
Enter assignment 1 points 14
Enter assignment 2 points 13
Enter assignment 3 points 10
Enter assignment 4 points 18
Enter assignment 5 points 15
Enter assignment 6 points 16
Enter assignment 7 points 13
Enter assignment 8 points 0
Enter assignment 9 points 11
Enter assignment 10 points 15
Enter assignment 11 points 14
Enter lab exercise points 33
Enter midterm points 35
Enter final points 71
Assignment Grades: 14 13 10 18 15 16 13 0 11 15 14
Assignment Points: 139
Lab Exercise: 33
Midterm: 35
Final: 71
Total Points: 278
Percent of total: 70%
Grade: C-
Not bad!
Test Case #3
Enter assignment 1 points 20
Enter assignment 2 points 19
Enter assignment 3 points 18
Enter assignment 4 points 20
Enter assignment 5 points 20
Enter assignment 6 points 19
Enter assignment 7 points 15
Enter assignment 8 points 20
Enter assignment 9 points 19
Enter assignment 10 points 20
Enter assignment 11 points 20
Enter lab exercise points 48
Enter midterm points 49
Enter final points 99
Assignment Grades: 20 19 18 20 20 19 15 20 19 20 20
Assignment Points: 195
Lab Exercise: 48
Midterm: 49
Final: 99
Total Points: 391
Percent of total: 98%
Grade: A+
Excellent work