Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Describe new developments in the design of pay structures. page 501

Answered: 1 week ago

Question

3 How the market system answers four fundamental questions.

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago