Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java, Student class (10) Has three instance variables: name and dept are of type String id is an int Default constructor uses mutators to

In Java,

Student class (10)

Has three instance variables:

name and dept are of type String

id is an int

Default constructor uses mutators to set name and dept to and id to 0.

The other constructor has three parameters for Siring name, int id, and String dept and uses the mutators to set the instance variables for these values.

There are three mutators and three accessors methods for the three instance variables.

There is a toString() method which returns the name, id and dept as a String on a single line

Department class (10)

Has two instance variables.

deptName a String variable

studentList an ArrayList of type Student

Default constructor uses the mutator to set deptName to

The other constructor has a String parameter for the deptName and uses a mutator to set the instance variable for this value.

method addStudent has a reference to a Student as a parameter and a void return.

It adds the reference to the Student to the studentList

method getStudentList has a no parameters and a reference to an ArrayList of type Student as a return value.

It returns a reference to the ArrayList studentList for this department

There is a mutator and accessor method for deptName.

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

Define dependent variables.

Answered: 1 week ago

Question

4. What decision would you make and why?

Answered: 1 week ago

Question

3. Review the evidence. Do you believe the testimony presented?

Answered: 1 week ago