Question: Java Programming Question Make a class that represents an average of test scores. Make the class take an unlimited number of scores and calculate the

Java Programming Question

Make a class that represents an average of test scores. Make the class take an unlimited number of scores and calculate the number of tests taken along with the average.

Given:
public class TestScoresDemo { public static void main(String[] args) { TestScores t1 = new TestScores("Alice"); TestScores t2 = new TestScores("Bob"); t1.addTestScore(50); t1.addTestScore(60); t1.addTestScore(54); t1.addTestScore(73); t1.addTestScore(88); t1.addTestScore(92); t2.addTestScore(87); t2.addTestScore(97); t2.addTestScore(37); t2.addTestScore(99); System.out.println("-- Alice --"); System.out.println("Num tests taken: " + t1.getNumTestsTaken()); System.out.println("Average: " + t1.getAverage()); System.out.println("-- Bob --"); System.out.println("Num tests taken: " + t2.getNumTestsTaken()); System.out.println("Average: " + t2.getAverage()); } } 

Required Output

-- Alice -- Num tests taken: 6 Average: 69.5 -- Bob -- Num tests taken: 4 Average: 80.0 

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!