Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Each Student is identified by a unique number ( ID ) . Some students may not yet have score values, and their scores may be

Each Student is identified by a unique number (ID). Some students may not yet have score
values, and their scores may be updated later. The application also supports student groups, where
different attributes can be used to assemble students.
The Student class represents a Student having the following three attributes:
A. ID: Identification of the student, (ii) name: Name of the student, (iii) score: The score
of the student. If no score value is provided, a value of -1.0 is used. There are two
constructors in the class. One takes all attributes specified by the parameters. The other
uses only the parameters' ID and name attributes, and its score value is -1.0, indicating
that this student has not yet been assigned a score or the score will be assigned later.
The withScore method creates a new Student instance with this Student's ID and name
and the supplied new score value.
B. A group of students is represented by the StudentGroup class. The constructor produces
an instance with the specified capacity, which is the maximum number of students the
instance may record. The addStudents function is used to add students to a
StudentGroup. The score value of a certain Student can be updated by calling the
updateStudent method, which employs some method defined by the Student class.
C. An Exception IllegalStateException is thrown when a new student object is tried to put
in StudentGroup where the capacity is exceeded. This exception is also thrown when
updateStudent method is called but no student is matched with the existing ids.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions