Question: This is based on problem 8.7 from the book. Implement a class Student: (1) instance variables: name: String scores: a set of grades between 0
This is based on problem 8.7 from the book.
Implement a class Student:
(1) instance variables: name: String scores: a set of grades between 0 and 100 stored in an array or arraylist. If you use array, set its length to be 50;
(2) instance methods default constructor: public Student() which initialize name to be "no name", and create an empty arraylist/array constructor to set the name: public Student(String initName), initialize name to be initName, and create an empty arraylist/array public void setName(String newName): which changes the name to be the new name public String getName(): which returns the name public void addQuiz(int score): add a score public int getTotalScore() public double getAverageScore(): if no score added yet, return 0 else return the average public char getLettterGrade(): if no score, return ' ', else calls getAverageScore, and convert the average score to letter grade, A for 90 and above, ...etc public String toString(): which returns all student name, scores, and letter grade as a single string
(3) use the attached class to test your class, the expected output should be follows:
Name: no name
Scores: [80, 70]
Grade: C
Name: Tom
Scores: [80, 70]
Grade: C
Name: Sally
Scores: []
Grade:
Name: Sally
Scores: [90, 89, 93]
Grade: A
StudentTest.java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
