Question: 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
Get step-by-step solutions from verified subject matter experts
