Question
Create a Faculty class, and a Staff class. The Faculty class should have an attribute to store the Faculty's title (a String) for example Instructor,
Create a Faculty class, and a Staff class. The Faculty class should have an attribute to store the Faculty's title (a String) for example "Instructor", "Assistant Professor". The Staff class should have an attribute called pay grade (an integer from 1 to 20)
here are the parent classes:
Person.java:
public class Person { protected String name; public Person(){ name = null; } public Person(String name){ this.name=name; } public String getName(){ return name; } public void setName(String Name){ this.name=name; } public boolean hasSameName(Person b){ if (this.name == (b.name)) return true; else return false; } public void writeOutput(){ System.out.print("Name: "+ name); } }
Employee.java:
public class Employee extends Person{ protected double salary; protected int yearHire; protected int emplID; protected String dept; public Employee(){ super(); salary = 0.0; yearHire = 0; emplID = 0; dept = null; } public Employee(String name, double salary, int yearHire, int emplID, String dept){ super(name); this.salary = salary; this.yearHire = yearHire; this.emplID = emplID; this.dept = dept; }
public double getSalary() { return salary; }
public void setSalary(double salary) { this.salary = salary; } public int getYearHire() { return yearHire; } public void setYearHire(int yearHire) { this.yearHire = yearHire; }
public int getEmplID() { return emplID; }
public void setEmplID(int emplID) { this.emplID = emplID; }
public String getDept() { return dept; } public void setDept(String dept) { this.dept = dept; } public boolean equals (Employee b){ if (this.emplID == b.emplID) return true; else return false; } public void writeOutput(){ super.writeOutput(); System.out.println(" Salary: "+ salary + " Year Hired: "+ yearHire + " Employee ID: "+ emplID + " Department: "+ dept); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started