Objectives
In this assignment, you will:
- Predict the output of looping programs.
- Draw flowcharts for looping programs.
- Write a program that uses a while loop to input course test grades until the user is done, and print out a "histogram" of grades.
Part 1: Course Programming Standards
Remember to use the course standards below.Part 2: Loop Assignment
a. Feb 20: C++ book, Chapter 10. The following exercises are due at the end of class, on paper.
- Write down the output of each of the programs in ALL chapter examples except 10-4.
For example 10-5 use the inputs 8, 21, 1, 2.1, and 0.5. For examples 10-6 and 10-7 use the inputs 3, 8, 7, 10, 0.- Answer the questions on pages 155-156, #1-20.
b. C++ Book, Chapter 10. Use any remaining time on Feb 20 to design the program below. Draw a flowchart for this program, and design at least 2 sets of input data and matching outputs as test cases, and hand these in on paper by the end of class on Feb 22. The program is due at 11:59 pm on Tuesday, Feb 27.
- Do Activity 10B, p 158, with the following modifications:
- Your program asks for a series of test grades (not just integers).
- Change the word "integer" to number for each item.
- Print a histogram of the grades in the course. For the list of grades:
A Sample output is given below:100
87.5
62
93
76
47
81
87
89.2
90
74
The "histogram" draws a * for each grade in that category. Use the standard grade breakdown of A is 90+, B is 80+, etc. Hint: Use a variable for each letter grade to count the number of grades in that category. Then to output the histogram, use a for loop to display a * for each one counted. For example, suppose that in this case there are 3 A grades, so iNumAs=3. My for loop to display A: *** is as follows:You entered 11 test scores. Average score: 80.61 Maximum score: 100 Minimum score: 47 Difference between max and min: 53
Histogram: A: *** B: **** C: ** D: * F: *int iNumAs=3, i; cout << "A: "; // Print asterisks for the number of As in the class. for (i=0; i < iNumAs; i++) { cout << "*"; } cout << endl;TURN-IN
You must log in to the CICS1214 course page through http://www.uncc.edu/49erexpress/, click on Homework 3, and attach a file named GradeHistogram.cpp that contains your code. If there is a problem with Blackboard, you are responsible for emailing the code to the course TA on TIME.
You are ALLOWED to work with others on this assignment, but you must: submit your own copy of the code, and note any collaboration in the header of your .cpp file.
Remember that you will need to be able to write your own programs to pass the tests in this course.
Homeworks will be accepted late at a penalty of 10 points per day.