Question
Write a complete Java class definition that solves the following problem: The name of the class is AgentEvaluator. The class is used to track a
Write a complete Java class definition that solves the following problem:
The name of the class is AgentEvaluator. The class is used to track a list of training scores for an agent. The class should contain one array attribute of double values called agentScores. The no-parameter constructor should initialize agentScores to an array of size 10, where the array elements are assigned using a for loop to the values shown below.
agentScores Index: [0], [1], [2], [3], [4], [5], [6], [7], [8], [9]
agentScores Content: 100, 99, 98, 97, 96, 95, 94, 93, 92, 91
Include the following instance methods in your class definition:
getTotal: returns the double typed total of the scores in the double array parameter, scores, using the while loop
getAverage: returns the double typed average of the scores in the agentScores array without parameters; this method uses the getTotal method to calculate the average, then returns the average result.
displayScores: no return and no parameter; displays all of the agentScores on one lie using a for loop, then, on the next line, displays the total and average of the agentScores together, labeled; this method uses the getAverage and getTotal methods; all output is to the console window as in the sample below:
10 scores: 98.0 45.0 100.0 76.0 80.0 93.0 88.0 95.0 33.0 51.0
Total: 759.0 Average: 75.9
Create Driver class with a main method that runs AgentEvaluator to show 10 scores of an agent as well as total and average labeled using standard output
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