Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1 Program Description We have multiple sections of a class for which we need to

ID: 3639586 • Letter: 1

Question

1 Program Description
We have multiple sections of a class for which we need to produce grading summaries by section. The grading summaries that we need are a count of how many students earned A’s, B’s, C's, etc., and the lowest, highest and average grade for each section. At the end of processing all sections the program will display a summary across all sections that will include the number of sections, the total number of scores and the average score across all sections.

Letter grades shall be determined by the below table:

A Equal to or greater than 90
B Less than 90 and greater than or equal to 80
C Less than 80 and greater than or equal to 70
D Less than 70 and greater than or equal to 60
F Less than 60
2 Input Description

The input will not be prompted. Each sections' data will consist of a count of the number of scores followed by the scores. All scores will be whole numbers. The count can be any non-negative number (including zero for no scores in a section). For instance:
5 81 91 93 78 63
indicates that there will be five (5) scores in this section and the scores are 81, 91, 93, 78, and 63.

There may be one or more sections in the input. Three sections of data would look like:
2 80 90
5 89 91 67 83 70
4 75 58 81 68
The first section contains two scores, the second section contains five scores, and the third section contains 4 scores.

The program should keep processing sections until an end of file is detected (cntl-d). You may assume that the largest score will be less than or equal to 100 and the smallest score will be greater than or equal to 0.

3 Output Description
The output will include:
• A label for the section
Scores for section N
where N is the n-th section processed.

• The counts of the number of A's, B's, C's, etc.
A's: 1
B's: 1
C's: 0
D's: 0
F's: 0

• The lowest score for this section (note this field shall print with NO decimals)
Lowest Section Score: 80

• The highest score for this section (note this field shall print with NO decimals)
Highest Section Score: 90

• The averages score for this section (note this field shall print with 2 decimals precision). If there are no scores the averages shall equal 0.00.
Average Section Score: 85.00

• At the end of processing all sections, a course summary will be printed. This will include the number of sections, the total number of scores in all sections and the average score across all sections. Note 1: This average is computed as the sum of all students’ scores divided by the number of students and is NOT the average of the section averages. The Class Average shall print with 2 decimals precision. If there are no scores the averages shall equal 0.00.
Total number of sections: 4
Total number of scores: 12
Class Average: 68.71

• At the end of processing the following message will be displayed.
That's all the sections!! Normal Termination.

• And Finally! For a section without any scores, the output should display zeros for all ouputs, including: letter grade counts (0), Low Score(0), High Score(0), and Average Score (0.00).
4 Hints
• Work on getting your program to process one score.
• Once your program can process one score, add a loop to process all of the scores in one section.
• Once you program can process a section of data, add an outer loop to process multiple sections.
• Remember that several variables will need to be reset at the beginning of each section, but other variables , those for class statistics, should not be reset.
• ctrl-d will trigger an end of file on standard input.
• The Class Average is computed as the sum of all students’ scores divided by the number of students and is NOT the average of the section averages. Be careful declaring your variables as the correct type.
• To set precision for 2 decimal places for output use the following code
//---------------------------------------
// turn on 2 decimal precision for the
// output of the Average Score
//---------------------------------------
cout << fixed << showpoint << setprecision(2);
• To reset outout to default output (no decimals for whole numbers) use the the following code (You do not necessarily need to use this if you do not need it)
//---------------------------------------
// turns off 2 digit decimal precision
//---------------------------------------
cout << scientific << noshowpoint;
5 Sample Runs


Test Case 1: Class with three sections.
Sample input 1
2 80 97
5 69 79 89 99 58
7 60 70 80 90 100 0 59

Sample output 1
2 80 97

Scores for section 1
A's: 1
B's: 1
C's: 0
D's: 0
F's: 0
Lowest Score: 80
Highest Score: 97
Average Score: 88.50

5 69 79 89 99 58

Scores for section 2
A's: 1
B's: 1
C's: 1
D's: 1
F's: 1
Lowest Score: 58
Highest Score: 99
Average Score: 78.80

7 60 70 80 90 100 0 59

Scores for section 3
A's: 2
B's: 1
C's: 1
D's: 1
F's: 2
Lowest Score: 0
Highest Score: 100
Average Score: 65.57


Total number of sections: 3
Total number of scores: 14
Class Average: 73.57

That's all the sections!! Normal Termination.

Here is my code thus far:



#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
int score; // input variable

int section = 0;
int high_score = 0; // highest score of section
int low_score = 0; // lowest score of section
float average_section = 0; // average of all scores in the section
float average_score = 0; // average scores of class
int total_sections = 0; // total number of sections
int total_scores = 0; // total number of scores
int A_count = 0;
int B_count = 0;
int C_count = 0;
int D_count = 0;
int F_count = 0;
int loop_count = 0;

cout << fixed << showpoint << setprecision(2);
cin >> section;
cin >> score;

loop_count = section;
while (loop_count == section)
{

if ((score >= 90) && (score <= 100));
A_count++;
score++;

if ((score >= 80) && (score < 90));
B_count++;
score++;

if ((score >= 70) && (score < 80));
C_count++;
score++;

if ((score >= 60) && (score < 70));
D_count++;
score++;

if (score < 60);
F_count++;
score++;

if (score < high_score);
high_score = score;

if (low_score < score);
low_score = score;


total_scores = score + 1;
total_sections = section + 1;
loop_count = loop_count + 1;
loop_count++;

cout << "A's: " << A_count << endl;
cout << "B's: " << B_count << endl;
cout << "C's: " << C_count << endl;
cout << "D's: " << D_count << endl;
cout << "F's: " << F_count << endl;

cout << "Lowest Score: " << low_score << endl;
cout << "Highest Score: " << high_score << endl;
cout << "Average Score: " <<(high_score+low_score )/ 2.0 <<endl;
cout << "Total number of scores: " << total_scores << endl;
cout << "Total number of sections: " << section << endl;

cout << endl << "That's all the sections!! Normal Termination." << endl;
cin >> score;

}

return 0;

}

Explanation / Answer

First let me start with an advise, learn few fundamental programming concepts, you program tells me that you are new to programming subject, but you approach is good as a beginner. Your approach is to solve the problem for one section and then move on to use a loop for executing the same for many number of sections, this is a very good approach, keep it up. Your first mistake is use of ";" after if statement. none of the programming languages have ";" after if or looping statements. This is my program after edits. #include #include using namespace std; int main() { int score[10][10]; /*input variable its an array which stores scores of all students across all the sections*/ int noofppl[10]; // new array which no of students in each section int section = 0; // number of sections int high_score = 0; // highest score of section int low_score =100; // lowest score of section //float average_section = 0; // average of all scores in the section int class_sum = 0; // total scores of class //int total_sections = 0; // total number of sections //int total_scores = 0; // total number of scores int A_count = 0; int B_count = 0; int C_count = 0; int D_count = 0; int F_count = 0; //int loop_count = 0; int sec_sum = 0; // sum of the scores of students in a single section int total_score = 0; // sum of the scores of all students in all sections int i,j; // temporary variables cout