Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA 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

JAVA

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

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 Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago