ITU wants you write some classes for their Personnel Record System. To make it simple, consider only 4 classes: Person, Employee, Instructor and Student. The following figure illustrates the relationship between these 4 classes. The Person class is the parent class of the Employee class and the Student class. The Employee class is the parent class of the Instructor class.

The following are the tasks you need to complete for each of these classes.

1. Create appropriate fields for each class. Necessary fields are listed. Add your own fields if needed. Some fields need to have appropriate constraint. Use your own way to make sure that these constraints are satisfied.

o Person
 ID: int, starting from 1 and should be unique
 Name: String
o Employee
 Salary: double and should not be negative
o Student (For simplicity, assume that a student has at most 1 teacher)
 TeacherID: int. It’s his/her instructor’s ID. 0 if no instructor is given
 TeacherName: String
o Instructor:
 StudentIDArray: int array. An array of students’ IDs of this instructor. Set the array size to be 10, initially all 0s, assuming an instructor won’t have more than 10 students.

2. All the above fields are private and only accessible through the access methods.

3. A “toString()” method for each class to print out all the available information about the current object. In Person class “toString()” is declared as abstract.


4. A static “findStudents(Person[] personArray)” method in the Instructor class to fill an instructor object’s students ID array, and the corresponding students’ TeacherID fields. See the test program for better understanding.

5. Person should be declared as abstract class.

6. Provide multiple constructors/methods if needed. Check the test.java program below to see what constructors/methods are necessary and what actions they should do.

7. If a class can use the parent class method and constructor, use “super” to call it to reduce the redundant code.

8. Make sure the test.java program can work with your class.

9. See the sample output below. From this sample output, you’ll know what information you should print out for a specific object.

NOTE: the sample output is not the unique output format of the test program. The real output format depends on how you design the toString() methods in each class. But make sure that your program will print out as much information about each object’s fields as possible, including the inherited fields and the fields defined in its own class.

HINT:
o There is NO main method in any of these 4 classes
o To make sure ID is unique across the objects, declare a static “LAST_ID” in the Person class.
o Read descriptions in test.java VERY CAREFULLY for better understanding!

Submit your Person.java, Emloyee.java, Student.java and Instructor.java files.

Ezzaral commented: Lazy students deserve to fail their courses. -3
apolishch commented: has not even tried to do any of the work +0
Mattox commented: It seems like they want other people to do the work for them +0
Member Avatar for ztini

So what do you have so far?

The way I see it the assignment IS the instructions! It is not like that you have been given only this:

>>>>
ITU wants you write some classes for their Personnel Record System. To make it simple, consider only 4 classes: Person, Employee, Instructor and Student. The following figure illustrates the relationship between these 4 classes. The Person class is the parent class of the Employee class and the Student class. The Employee class is the parent class of the Instructor class.
<<<<

The rest of the assignment tells you exactly what you need to do. Example:

Person
ID: int, starting from 1 and should be unique
Name: String

Create a Parent class with the above attributes


or

The Employee class is the parent class of the Instructor class.

It tells you which class extends what

Just create the classes using the instructions given. I am sure that you have
notes on how to create classes with attributes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.