Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a class named Testscores. This class has a private array of test scores.. The constructor should accept an integer argument and dynamically allocate the
Write a class named Testscores. This class has a private array of test scores.. The constructor should accept an integer argument and dynamically allocate the array to hold that many scores. The constructor stores the argument in the size attribute. The destructor should free the memory held by the array. In addition, there should be methods to perform the following operations: Store a test score in a specified element of the array. * Retrieve a test score from a specified element of the array Return the highest score stored in the array. Return the lowest score stored in the array. Return the average of all scores stored in the array. Your class should be implemented using the following UML diagram: TestScores scores: int -size: int +TestScores(s: int): TestScores(): +setScore(i: int, s: int): void +getScore(i: int): int +getAverage: double +getHighScore(): int +getLowScore(: int The class itself must not interact with the user in any way. All accessors should be marked const. size stores the number of elements in the array. scores is a pointer that stores the memory address for the array. Do not use global variables Your program should ask the user how many scores they want to store and then ask the user for each score and store it in a TestScores object. The program should then display all the scores, their average, the high score, and the low score
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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