Programming and Problem Solving I - Project 6 Problems | 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-278
koofers-user-278 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CECS 174 Project 6 - Due in lab on Tuesday, 11/18/03
The program you wrote for Project 5 works fine for a small class where the number of scores that needs to be
entered is sufficiently small. This project is designed to handle larger classes. The specification of this project
extends from Project 5 in four ways:
1. The number of scores may be large, and they may be stored in a file as a sequence of integers, separated by
blanks. Therefore, no prompting for input is needed. Use input redirection on UNIX command instead.
2. Long parameter list is in general undesirable. Use an array to implement the grade counters to avoid long
parameter list.
3. Besides showing the number of grades in each grade level, compute and report the percentage of grades in
each level as well. The percentages are computed to integers with the normal rounding (e.g., 13.34 is
rounded to 13, whereas 13.76 is rounded to 14.)
4. Draw a bar graph to show the distribution of grades in percentage.
Grading scale:
A: score >= 90
B: 80 <= score < 90
C: 70 <= score < 80
D: 60 <= score < 70
F: score < 60
When your program executes with the data file shown below, it should produce output as in the following
sample dialogue:
Scores input:
55.00 80.50 37.00 98.00 91.50 67.90 88.00 74.00 81.05 62.50
33.70 93.00 95.00 84.00 73.00 81.00 77.50 70.20 90.00 55.00
74.00 66.00 73.00 79.00 62.00 84.00 86.00 76.50 91.00 64.00
Average score = 74.78
Standard Deviation = 15.43
Grade Number of Students Percentage
A 6 20
B 7 23
C 8 27
D 5 17
F 4 13
Bar graph:
A ( 20%) |********************
B ( 23%) |***********************
C ( 27%) |***************************
D ( 17%) |*****************
F ( 13%) |*************
pf2

Partial preview of the text

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

CECS 174 Project 6 - Due in lab on Tuesday, 11/18/

The program you wrote for Project 5 works fine for a small class where the number of scores that needs to be entered is sufficiently small. This project is designed to handle larger classes. The specification of this project extends from Project 5 in four ways:

  1. The number of scores may be large, and they may be stored in a file as a sequence of integers, separated by blanks. Therefore, no prompting for input is needed. Use input redirection on UNIX command instead.
  2. Long parameter list is in general undesirable. Use an array to implement the grade counters to avoid long parameter list.
  3. Besides showing the number of grades in each grade level, compute and report the percentage of grades in each level as well. The percentages are computed to integers with the normal rounding (e.g., 13.34 is rounded to 13, whereas 13.76 is rounded to 14.)
  4. Draw a bar graph to show the distribution of grades in percentage. Grading scale: A: score >= 90 B: 80 <= score < 90 C: 70 <= score < 80 D: 60 <= score < 70 F: score < 60 When your program executes with the data file shown below, it should produce output as in the following sample dialogue: Scores input: 55.00 80.50 37.00 98.00 91.50 67.90 88.00 74.00 81.05 62. 33.70 93.00 95.00 84.00 73.00 81.00 77.50 70.20 90.00 55. 74.00 66.00 73.00 79.00 62.00 84.00 86.00 76.50 91.00 64. Average score = 74. Standard Deviation = 15. Grade Number of Students Percentage A 6 20 B 7 23 C 8 27 D 5 17 F 4 13 Bar graph: A ( 20%) |******************** B ( 23%) |*********************** C ( 27%) |*************************** D ( 17%) |***************** F ( 13%) |*************

__________________________________________________________________________________________

Data file used in the above sample output: 55 80.5 37 98 91.5 67.9 88 74 81.05 62. 33.7 93 95 84 73 81 77.5 70.2 90 55 74 66 73 79 62 84 86 76.5 91 64 New features needed :  Declare and use arrays.  Pass array as a parameter in function call.  Header file for setw in output.


Do the following:  Name your program file lab6.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 lab6.cpp b) g++ lab6.cpp c) a.out < data (This command instructs UNIX to get input from the file named data instead of from the standard input, i.e., the keyboard.)  Print and hand in a hardcopy of the typescript file.  Demo your program on the due date.