/** * A class that computes a student's average */ public class Student { /** * Construct a student with a name, amount of quizzes taken, and the total score * of those quizes * @param name The student's name. * @param quizzesTaken The total number of quizzes taken. * @param totalScore The total score the student received on all quizzes. */ public Student(String name, int quizzesTaken, int totalScore) { student = name; quizzes = quizzesTaken; total = totalScore; } /** * Returns the student's name. */ public String getName() { return student; } /** * Adds a new quiz to the amount of quizzes taken, * and the new quiz's score to the total score. *@param score The score the student recieved on the new quiz. */ public int addQuiz(int score) { totalScore = total + score; quizzes = getQuizzesTaken() + 1; return totalScore; } /** * Returns the amount of quizzes taken. */ public int getQuizzesTaken() { return quizzes; } /** * Returns the total score of all the quizzes. */ public int getTotalScore() { return totalScore; } /** * Computes and returns the student's average. */ public double getAverageScore() { avg = totalScore/quizzes; return avg; } public double avg; public String student; public int quizzes; public int quizzesTaken; public int total; public int totalScore; }