Question
You will be given a file that will contain averages for classes which are divided into sections in the following format. The name of this
You will be given a file that will contain averages for classes which are divided into sections in the following format. The name of this file will be "grades.txt".
A 93
B 82
A 86
C 75
F 83
You are to write a program that computes the averages for the sections of classes, they are divided into groups that are denoted by a capital letter. You are to use arrays to calculate the average. I recommend using two arrays one to keep a sum of the averages and the other a counter for how many classes have been added to the sum.
The equation for calculating the average is:
(sum of numbers in list) / (number of numbers in list)
Given this you can have one array to keep a sum of the numbers that you are given and the other to keep a count of the number of classes in that section. The section names will be from A - Z and will always be capital letters. The averages will be from 0 - 100 inclusively.
Your program should output to the console the highest average section, lowest average section, and the average score across all of the sections. Output both the section name and the score for that section. To a file you will print the average for each section in alphabetical order. Always output the scores with two decimal places.
HIGHEST AVERAGE:................A:98.00
LOWEST AVERAGE:.................H:73.00
AVERAGE SCORE:....................85.00
To a file named "results.txt":
A: 98.00
B: 93.00
C: 85.21
D: 95.12
.
.
.
Z: 78.25
Step by Step Solution
3.38 Rating (151 Votes )
There are 3 Steps involved in it
Step: 1
ANSWER CODE include include include include include using namespace std Fun...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started