This programming project is on page 664 of your textbook (#6) For this Programmi
ID: 3673206 • Letter: T
Question
This programming project is on page 664 of your textbook (#6) For this Programming Project, start with implementations of the Person, Student, and Undergraduate classes as depicted in Figure 8.4 and the polymorphism demo in Listing 8.6. Define the Employee, Faculty, and Staff classes as depicted in Figure 8.2. The Employee class should have instance variables to store the employee ID as an int and the employee’s department as a String. The Faculty class should have an instance variable to store the faculty member’s title (e.g. "Professor of Computer Science") as a String. The Staff class should have an instance variable to store the staff member’s pay grade (a number from 1 to 20) as an int. Every class should have appropriate constructors, accessors, and mutators, along with a writeOutput method that outputs all of the instance variable values.
Modify the program in Listing 8.6 to include at least one Faculty object and at least one Staff object in addition to the Undergraduate and Student objects. Without modification to the for loop, the report should output the name, employee ID, department, and title for the Faculty objects, and the name, employee ID, department, and pay grade for the Staff objects. Instructions
1. Name your java programs Employee.java, Faculty.java, Staff.java and PolymorphismDemo.java.
Explanation / Answer
Hi, I have implemented Employee.java, Staff.java, Faculty.java. Since your question is dependent on some other questions that implements Person, UnserGraduate and Student. So, I do not know their implementation.Hence i am not able to write PolymorphismDemo.java.
You use my classes and add in your existing program.
//Employee.java
public class Employee {
private int ID;
private String department;
public Employee(int id, String dept) {
ID = id;
department = dept;
}
public int getID() {
return ID;
}
public void setID(int iD) {
ID = iD;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
}
//Staff.java
public class Staff {
private int payGrade;
public Staff(int pay) {
pay = pay;
}
public int getPayGrade() {
return payGrade;
}
public void setPayGrade(int payGrade) {
this.payGrade = payGrade;
}
}
//Faculty.java
public class Faculty {
private String title;
public Faculty(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.