Question: Create a Java Eclipse project named lastfirstL02, replacing last and first with your name. Unless otherwise stated, each object should be alone in a file.

Create a Java Eclipse project named "lastfirstL02", replacing last and first with your name. Unless otherwise stated, each object should be alone in a file. Remember: You must use methods effectively to avoid duplicating code. Be sure to zip and submit the entire project.

You will be helping a database administrator save data into the Java program that resembles the database's hierarchy:

You can find reference pic here: https://hw-support-docs.zyrosite.com/

Be sure to read all the instructions and notes before coding.

All notes can be found here: https://hw-support-docs.zyrosite.com/

Data input : The supporting docs for this can be found here: https://hw-support-docs.zyrosite.com/

  • employees.txt csv data to create professors and administrators
    • first row is header information
    • assume no errors in the data file
    • if isadm is true, create an Administrator object; otherwise, create a Professor object
    • the ranktitle depends on the type of person
  • students.txt
    • first row is header information
    • assume no errors in the data file
    • if type is g, create a Graduate object; otherwise, create an Undergrad object
    • thesishours depends on the type of student

Data output

  • Print output to the console
  • Print ArrayLists directly, e.g., System.out.println(people); would print the Person ArrayList
  • Pay attention to spacing and new line characters in your toString() methods to achieve the same output
  • See output.docx as an example, but also note:
    • One person per line, but still comma separated because of ArrayList printing
    • All the offices are on one line, comma separated, but may line wrap

Office

  • Officenum and officephone are private Strings
  • The constructor has parameters for the number and phone
  • Accessors and mutators for the number and phone

Person

  • ID is a private integer, not inherited by subclasses
  • lname and fname are Strings
  • The contructor brings in values for all data members
  • accessors and mutators for ID, lname, fname

Employee

  • hiredate is a String
  • add an Office object call office
  • The constructor
    • bring in values for all data members
    • the office will be instantiated using the values
  • accessors and mutators for hiredate, office number, office phone
  • special accessor that returns the office object
  • special mutator for office that brings in an Office object to assign
  • special mutator for office that bring in the number and phone to instantiate a new Office

Student Interface

  • ensure that Student objects have accessors and mutators
  • does not have any constants nor default methods

Student

  • implements the student interface
  • major is a String
  • The constructor brings in values for all data members
  • accessor and mutators for major

Graduate

  • thesis is a String
  • The constructor brings in values for all data members
  • accessors and mutators for thesis

Undergrad

  • hours is an integer
  • constructor bring in values for all data members
  • accessor and mutator for hours
  • special mutator for hours that adds the amount passed into the hours

Database

  • Has the main method
    • Instantiates ArrayLists
      • people ArrayList of Person objects
      • clones ArrayList of Person objects
      • offices ArrayList of Office objects
    • Processes the data in this order (methods described below):
      • Read and store the employee data
      • Read and store the student data
      • Create the clones of people
      • Set the phone number
      • Clone and sort the offices
      • Print people, then clones, then offices
  • Has a method to read in the employee data
    • Passes in the people ArrayList
    • Creates Administrator or Professor objects
    • Stores the objects in the people ArrayList
    • void return type
  • Has a method to read in the student data
    • Passes in the people ArrayList
    • Creates Graduate and Undergraduate objects
    • Stores the objects in the people ArrayList
    • void return type
  • Has a method to create clones of the people and sorts the clones
    • Passes in the people and clone ArrayList
    • Creates the clones and stores the new objects in the clones ArrayList
    • Uses the ArrayList sort method on clones (not Collections.sort() look up the sort method for ArrayLists)
    • void return type
  • Has a method to set a phone number
    • Passes in the clone ArrayList
    • Finds the first Professor object in the ArrayList (use instanceof) and sets the phone to "357-5751"
    • void return type
  • Has a method to clone the offices from the clones ArrayList
    • Passes in the clone and offices ArrayLists
    • Clones the offices and places the new objects in the offices ArrayList
      • These are the offices of Administrators and Professors
      • Use instanceof to find Employee objects (which will find Administrators and Professors)
    • Uses the ArrayList sort method on offices (not Collections.sort() look up the sort method for ArrayLists)
    • void return type
  • Has a method to print the array lists
    • Passes in the people, clones, and offices ArrayLists
    • Prints them in the order of people, clones, then offices
      • Note that the toString() methods you wrote should allow printing, e.g.:

System.out.println(people);

System.out.println();

System.out.println(clones);

System.out.println();

System.out.println(offices);

  • void return type

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!