Question: HELP IN JAVA: Create a main method and use these input files to test that you are able to input the Undergraduates, put them into

HELP IN JAVA:

Create a main method and use these input files to test that you are able to input the Undergraduates, put them into an ArrayList, print out the list. Repeat for Graduate, Faculty, Staff. Do it all in ONE main.

Then- Add a compareTo to each class (and any other code you need) so you can sort all your ArrayLists and print out the results. Your final output should be all the Undergraduates (sorted), all the Graduates (sorted), all the Faculty(sorted), and all the Staff (sorted).

To sort: Sort undergrads and grads according to ID. Sort Faculty according to Department and Staff according to Salary.

I have Lab10.java to keep main in but it is not completed, which is what im seeking help for.

I have Person.java ; Student.java ; Employee.java ; Undergraduate.java ; Graduate.java ; Faculty.java & Staff.java completed.

Thanks!!!!!!!

Student.java

public class Student extends Person { private int studentNumber; public Student(){ super(); //call to constructor of Person studentNumber=0; } public Student(String initialName, int initialStudentNumber){ super(initialName); //call to constructor of Person studentNumber=initialStudentNumber; }

public int getStudentNumber() { return studentNumber; }

public void setStudentNumber(int studentNumber) { this.studentNumber = studentNumber; } public void Reset(String newName, int newNumber){ setName(newName); this.studentNumber=newNumber; } public void WriteOutput(){ super.WriteOutput(); System.out.println("Student Number: "+studentNumber); } public boolean Equals(Student other){ return this.hasSameName(other)&&(this.studentNumber==other.studentNumber); } }

Person.java

public class Person { private String name; public Person(){ name="No name yet"; } public Person (String initialName){ name=initialName; }

//refactor-encapsulate field getSetter public String getName() { return name; }

public void setName(String name) { this.name = name; } public void WriteOutput() { System.out.println("Name: "+name); } public boolean hasSameName(Person other){ return this.name.equalsIgnoreCase(other.name); //if (this.hasSameName(other)) } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!