Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting Principles Volume 2

Authors: Jerry J. Weygandt, Donald E. Kieso, Paul D. Kimmel, Barbara Trenholm, Valerie Warren, Lori Novak

8th Canadian Edition

1119502551, 1-119-50255-5, 978-1119502555

More Books

Students also viewed these Programming questions

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

Define span of management or define span of control ?

Answered: 1 week ago

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago