CIS 1033 - Fundamentals of Programming

Bob Comer, Professor, CIS/CSC


Programming Assignment 4 - Grade Distribution

Due Wednesday, June 23

This is basically program 5 on page 173 of your textbook. Write a C++ program to read a list of numeric grades on a 0 to 100 scale and print the corresponding letter grade based on the table:

Numeric Grade

Letter Grade

90 <= grade

A

80 <= grade < 90

B

70 <= grade < 80

C

60 <= grade < 70

D

      grade < 60

F

Your program should continue to read numeric grades until a negative number is input. Then your program should print a summary showing a count of the number of A 's, the number of B's, the number of C's, the number of D's, and the number of F's.

Data 

Variable

Description

grade

grade on 0 - 100 scale

numAs

number of A's scored

numBs

number of B's scored

numCs

number of C's scored

numDs

number of D's scored

numFs

number of F's scored

Sample Output
Your output should look like the example below. User input is shown in bold.
 

Enter a list of grades on a 0 - 100 scale.
Enter -1 to end.

Enter next grade: 82
The grade is B
Enter next grade: 95
The grade is A
Enter next grade: 77
The grade is C
.
.
.
Enter next grade: -1

There were:
3 A's
2 B's
2 C's
1 D's
0 F's


Return to Fundamental's Home Page

Copyright: Ó1999 by the Austin Community College

Department of Computer Studies. All rights reserved.

Comments to: Bob Comer

Last updated: June 14, 1999