Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Write a program to test the class. (StudentTester) Prompt the user for a name and a set of quiz scores. Once the user is

Java

Write a program to test the class. (StudentTester) Prompt the user for a name and a set of quiz scores. Once the user is done entering scores, display the total score and the average score.

Here is my Student class code:

public class Student {

String name;

int totalQuizScore;

int numberOfQuizzes;

public Student(String name) {

this.name = name;

this.totalQuizScore = 0;

this.numberOfQuizzes = 0;

}

public String getName() {

return this.name;

}

public int getTotalScore() {

return this.totalQuizScore;

}

public void addQuiz(int score) {

this.numberOfQuizzes++;

this.totalQuizScore += score;

}

public double getAverageScore() {

return this.totalQuizScore / this.numberOfQuizzes;

}

}

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 Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions