Answered step by step
Verified Expert Solution
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
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