Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question involves writing a complete java class called Student. Please write the complete code for this class according to the following specification: a .

This question involves writing a complete java class called Student. Please write the complete code for this class according to the following specification:
a. Fields: private fields that store the following:
i. name (as a String)
ii. id (as an int)
iii. scores (as an ArrayList of type Integer that will store student test scores).
b. Constructor: This takes name and id as parameters and sets the class private fields. It also initializes the private field scores to a new empty ArrayList of type Integer.
c. Methads:
i. getName larr Accessor for the name private field.
ii. getID larr Accessor for the id private field.
iii. BetGrade larr Returns the average of all the test scores in the scores private field.
iv. addTest larr Adds a new int score to the scores private field.
v. toString larr Returns a String having the following format:
"ID: id, Name: name, Grade: grade"
where id and name are the values in the class private fields, and the grade is the average of the student's test scores, as calculated by the method getGrade from point iii. above.
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

How does compound interest differ from simple interest?

Answered: 1 week ago