Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need it in only these 4 files please : TestScore.h TestScore.cpp NegativeScore.h TestScoreWithTryCatch.cpp 16-7. TestScores Class Write a class named TestScores: One of the

I need it in only these 4 files please :

TestScore.h TestScore.cpp NegativeScore.h TestScoreWithTryCatch.cpp

16-7. TestScores Class

Write a class named TestScores:

One of the class constructors should accept an array of test scores and a variable containing the size of the array as its arguments.

The class should have a member function (getAverage()) that returns the average of the test scores.

If any test score in the array is negative or greater than 100, the class should throw an exception.

Write a class named NegativeScore:

This class will be used as the variable type in the catch(NegativeScore BadScore) statement.

It should have a constructor (int score).

It should also have a getScore() member.

Suggestion: Write a program to test the Try/Catch statements by defining an array of:

Good scores, int myScores[NUM_SCORES] = { 88, 90, 93, 87, 99 };

Bad scores, int badScores[NUM_SCORES] = { 88, 90, -99, 87, 99 };

Submit the following files: TestScore.h TestScore.cpp NegativeScore.h TestScoreWithTryCatch.cpp

Sample output: The average score is 91.4 An invalid score was found. The invalid score is -99 Press any key to continue . . .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

What is operatiing system?

Answered: 1 week ago