Programming and Problem Solving I - Lab Project 4 | CECS 174, Lab Reports of Computer Science

Material Type: Lab; Class: Programming & Problem Solving I; Subject: Computer Engr & Computer Sci; University: California State University - Long Beach; Term: Fall 2003;

Typology: Lab Reports

Pre 2010

Uploaded on 08/18/2009

koofers-user-jpu
koofers-user-jpu 🇺🇸

5

(1)

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CECS 174 Project 4 - Due in lab on Tuesday, 10/28/03
Write a C++ program that reads in student scores. For each score it reads in, determine if the score is an A, B,
C, D, or F, according to the scale given below. Your program should also keep track of the number of students
in each grade category, and the average of all scores that the user inputs.
Grading scale:
A: score >= 90
B: 80 <= score < 90
C: 70 <= score < 80
D: 60 <= score < 70
F: score < 60
When your program executes, it should produce output as in the following sample dialogue:
Enter all scores below, one score per line. Press control-d when done.
55
Input score is 55.00, grade F
78.5
Input score is 78.50, grade C
98
Input score is 98.00, grade A
77
Input score is 77.00, grade C
80.55
Input score is 80.55, grade B
90
Input score is 90.00, grade A
Number of scores = 6
Average score = 79.84
Grade Number of Students
A 2
B 1
C 2
D 0
F 1
__________________________________________________________________________________________
C++ Statements Needed:
Declaration for int and double variables.
Input and output (cout << and cin >>).
Loop, controlled by end of input.
if-else statements.
Function for the determination and output of the appropriate grade for a given score.
__________________________________________________________________________________________
pf2

Partial preview of the text

Download Programming and Problem Solving I - Lab Project 4 | CECS 174 and more Lab Reports Computer Science in PDF only on Docsity!

CECS 174 Project 4 - Due in lab on Tuesday, 10/28/

Write a C++ program that reads in student scores. For each score it reads in, determine if the score is an A, B, C, D, or F, according to the scale given below. Your program should also keep track of the number of students in each grade category, and the average of all scores that the user inputs. Grading scale: A: score >= 90 B: 80 <= score < 90 C: 70 <= score < 80 D: 60 <= score < 70 F: score < 60 When your program executes, it should produce output as in the following sample dialogue: Enter all scores below, one score per line. Press control-d when done. 55 Input score is 55.00, grade F

Input score is 78.50, grade C 98 Input score is 98.00, grade A 77 Input score is 77.00, grade C

Input score is 80.55, grade B 90 Input score is 90.00, grade A Number of scores = 6 Average score = 79. Grade Number of Students A 2 B 1 C 2 D 0 F 1


C++ Statements Needed :  Declaration for int and double variables.  Input and output (cout << and cin >>).  Loop, controlled by end of input.  if-else statements.  Function for the determination and output of the appropriate grade for a given score.


Do the following:  Name your program file lab4.cpp and place it in your 174 subdirectory.  Document your program following the Program Documentation Guide which may be accessed through http://www.cecs.csulb.edu/~lam/cecs174/course-notes.html  Make sure your program’s output matches the sample dialogue given above.  Use script to get a typescript file that captures: a) cat lab4.cpp b) g++ lab4.cpp c) a.out.  Print and hand in a hardcopy of the typescript file.  Demo your program on the due date.