Question: GNU++11/C++11 An input file will contain a list of grades using the following format: [Designation] [Grade] Where Designation will match a single character from the

GNU++11/C++11

An input file will contain a list of grades using the following format: [Designation] [Grade]

Where Designation will match a single character from the respective column in the above table, and Grade will be a percentage. For example,

Q 100 A 90

The first line shows a quiz grade with the value of 100. The second line shows an assignment grade with the value of 90. Note that when calculating the weighted average, only weights that have grades are calculated. That is, in the above example, there are no tests nor exams to calculate, so the denominator will not be 1, but rather 0.25+0.35=0.6.

The program accepts 2 input parameters on the command line. The first is the name of the input file, the second is the name of the output file.

REQUIREMENTS

  1. Implement the GradeCalculator::Load and GradeCalculator::CalculateAverage functions. a. Load should fill the m_Grades vector b. CalculateAverage should return a pair containing the count and average for the type

    provided

  2. Neither function should contain a user-defined loop.

  3. There should be no memory leaks.

  4. The only changes will be where the // TODO

  5. There should be no additional functions nor data types added.

    void GradeCalculator::Load(std::istream& is)

    {

    // TODO Load the grades without writing a loop

    // NOTE ensure the grades vector only contains the newly loaded grades

    }

    CountAverage GradeCalculator::CalculateAverage(Grade::Type type) const

    {

    // TODO Calculate the count and average for the provided type without writing a loop

    }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!