Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Person, Student, Employee, Faculty, andStaff classes) Design a class named P

ID: 3614376 • Letter: T

Question

The Person, Student, Employee, Faculty, andStaff classes) Design a class named

Person and its two subclasses named Student andEmployee. Make Faculty and Staff

subclasses of Employee. A person has a name,address, phone number, and email

address. A student has a class status (freshman,sophomore, junior, or senior). Define

the status as a constant. An employee has anoffice and salary. A faculty member has

office hours and a rank. A staff member has atitle. Override the toString method in

each class to display theclass name and the person'sname. Implement theclasses.

Write a test program that creates a Person,Student, Employee, Faculty, and Staff, and

invokes their toString() methods

Explanation / Answer

With no UML or specifics, I couldn't really privatize orpublicize any variables or anything. So I did a basic program thatdoes what I think you were asking for. It took a LONG time...

public class Person { String name; String adress; int phonenumber; String email; String type; public Person(String name1, String address1, int phone, Stringemail1) { name = name1; adress = address1; phonenumber = phone; email = email1; type = "Person"; } public String toString() { return ("Name: " + name + "Class: " + type + "Address: " +adress + "Phone #: " + phonenumber + "Email: " + email); }
}

public class Student extends Person { String status = "Freshman"; //Freshman by default public Student(String name1, String address1, int phone,String email1,int status1) { super(name1,address1,phone,email1); if(status1 == 1) { status = "Freshman"; } if(status1 == 2) { status = "Sophomore"; } if(status1 == 3) { status = "Junior"; } if(status1 == 4) { status = "Senior"; } type = "Student"; } public String toString() { return super.toString() + "Status: " + status; } }


public class Employee extends Person { String office; int salary; public Employee(String name1, String address1, int phone,String email1, String office1, int salary1) { super(name1,address1,phone,email1); office = office1; salary = salary1; type = "Employee"; } public String toString() { return (super.toString() + "Office: " + office +"Salary: " + salary); }
}


public class Faculty extends Employee {
String officehours; String title; public Faculty(String name1, String address1, int phone,String email1,String office1, int salary1, String officehours1,String title1) { super(name1,address1,phone,email1,office1,salary1); officehours = officehours1; title = title1; type = "Faculty"; } public String toString() { return (super.toString() + "Office Hours: " + officehours +"Title: " + title); }
}


public class Staff extends Employee {
String title; public Staff(String name1, String address1, int phone, Stringemail1,String office1, int salary1, String title1) { super(name1,address1,phone,email1,office1,salary1);
title = title1; type = "Faculty"; } public String toString() { return (super.toString() + "Title: " + title); }
}


public class Tester { public static void main(String args[]) { Person person1 = new Person("George", "1441 Somewhere lane",7041075, "fakeguy@cox.net"); Student student1 = new Student("Bob", "1341 Somewhere lane",7041275, "fakeguy2@cox.net", 1); Employee employee1 = new Employee("Frank", "1421 Somewherelane", 704133, "fakeguy3@cox.net","Office1", 5000); Faculty faculty1 = new Faculty("Roberta", "2421 Somewherelane", 604133, "fakeguy4@cox.net","Office3", 10000, "10:00 - 3:00","Teacher"); Staff staff1 = new Staff("Dora", "3421 Somewhere lane",404133, "fakeguy6@cox.net","Office2", 700, "Substitute"); System.out.println(person1.toString()); System.out.println(student1.toString()); System.out.println(employee1.toString()); System.out.println(faculty1.toString()); System.out.println(staff1.toString()); }
}

public class Student extends Person { String status = "Freshman"; //Freshman by default public Student(String name1, String address1, int phone,String email1,int status1) { super(name1,address1,phone,email1); if(status1 == 1) { status = "Freshman"; } if(status1 == 2) { status = "Sophomore"; } if(status1 == 3) { status = "Junior"; } if(status1 == 4) { status = "Senior"; } type = "Student"; } public String toString() { return super.toString() + "Status: " + status; } }


public class Employee extends Person { String office; int salary; public Employee(String name1, String address1, int phone,String email1, String office1, int salary1) { super(name1,address1,phone,email1); office = office1; salary = salary1; type = "Employee"; } public String toString() { return (super.toString() + "Office: " + office +"Salary: " + salary); }
}


public class Faculty extends Employee {
String officehours; String title; public Faculty(String name1, String address1, int phone,String email1,String office1, int salary1, String officehours1,String title1) { super(name1,address1,phone,email1,office1,salary1); officehours = officehours1; title = title1; type = "Faculty"; } public String toString() { return (super.toString() + "Office Hours: " + officehours +"Title: " + title); }
}


public class Staff extends Employee {
String title; public Staff(String name1, String address1, int phone, Stringemail1,String office1, int salary1, String title1) { super(name1,address1,phone,email1,office1,salary1);
title = title1; type = "Faculty"; } public String toString() { return (super.toString() + "Title: " + title); }
}


public class Tester { public static void main(String args[]) { Person person1 = new Person("George", "1441 Somewhere lane",7041075, "fakeguy@cox.net"); Student student1 = new Student("Bob", "1341 Somewhere lane",7041275, "fakeguy2@cox.net", 1); Employee employee1 = new Employee("Frank", "1421 Somewherelane", 704133, "fakeguy3@cox.net","Office1", 5000); Faculty faculty1 = new Faculty("Roberta", "2421 Somewherelane", 604133, "fakeguy4@cox.net","Office3", 10000, "10:00 - 3:00","Teacher"); Staff staff1 = new Staff("Dora", "3421 Somewhere lane",404133, "fakeguy6@cox.net","Office2", 700, "Substitute"); System.out.println(person1.toString()); System.out.println(student1.toString()); System.out.println(employee1.toString()); System.out.println(faculty1.toString()); System.out.println(staff1.toString()); }
}

public class Employee extends Person { String office; int salary; public Employee(String name1, String address1, int phone,String email1, String office1, int salary1) { super(name1,address1,phone,email1); office = office1; salary = salary1; type = "Employee"; } public String toString() { return (super.toString() + "Office: " + office +"Salary: " + salary); }
}


public class Faculty extends Employee {
String officehours; String title; public Faculty(String name1, String address1, int phone,String email1,String office1, int salary1, String officehours1,String title1) { super(name1,address1,phone,email1,office1,salary1); officehours = officehours1; title = title1; type = "Faculty"; } public String toString() { return (super.toString() + "Office Hours: " + officehours +"Title: " + title); }
}


public class Staff extends Employee {
String title; public Staff(String name1, String address1, int phone, Stringemail1,String office1, int salary1, String title1) { super(name1,address1,phone,email1,office1,salary1);
title = title1; type = "Faculty"; } public String toString() { return (super.toString() + "Title: " + title); }
}


public class Tester { public static void main(String args[]) { Person person1 = new Person("George", "1441 Somewhere lane",7041075, "fakeguy@cox.net"); Student student1 = new Student("Bob", "1341 Somewhere lane",7041275, "fakeguy2@cox.net", 1); Employee employee1 = new Employee("Frank", "1421 Somewherelane", 704133, "fakeguy3@cox.net","Office1", 5000); Faculty faculty1 = new Faculty("Roberta", "2421 Somewherelane", 604133, "fakeguy4@cox.net","Office3", 10000, "10:00 - 3:00","Teacher"); Staff staff1 = new Staff("Dora", "3421 Somewhere lane",404133, "fakeguy6@cox.net","Office2", 700, "Substitute"); System.out.println(person1.toString()); System.out.println(student1.toString()); System.out.println(employee1.toString()); System.out.println(faculty1.toString()); System.out.println(staff1.toString()); }
}

public class Faculty extends Employee {
String officehours; String title; public Faculty(String name1, String address1, int phone,String email1,String office1, int salary1, String officehours1,String title1) { super(name1,address1,phone,email1,office1,salary1); officehours = officehours1; title = title1; type = "Faculty"; } public String toString() { return (super.toString() + "Office Hours: " + officehours +"Title: " + title); }
}


public class Staff extends Employee {
String title; public Staff(String name1, String address1, int phone, Stringemail1,String office1, int salary1, String title1) { super(name1,address1,phone,email1,office1,salary1);
title = title1; type = "Faculty"; } public String toString() { return (super.toString() + "Title: " + title); }
}


public class Tester { public static void main(String args[]) { Person person1 = new Person("George", "1441 Somewhere lane",7041075, "fakeguy@cox.net"); Student student1 = new Student("Bob", "1341 Somewhere lane",7041275, "fakeguy2@cox.net", 1); Employee employee1 = new Employee("Frank", "1421 Somewherelane", 704133, "fakeguy3@cox.net","Office1", 5000); Faculty faculty1 = new Faculty("Roberta", "2421 Somewherelane", 604133, "fakeguy4@cox.net","Office3", 10000, "10:00 - 3:00","Teacher"); Staff staff1 = new Staff("Dora", "3421 Somewhere lane",404133, "fakeguy6@cox.net","Office2", 700, "Substitute"); System.out.println(person1.toString()); System.out.println(student1.toString()); System.out.println(employee1.toString()); System.out.println(faculty1.toString()); System.out.println(staff1.toString()); }
}

public class Staff extends Employee {
String title; public Staff(String name1, String address1, int phone, Stringemail1,String office1, int salary1, String title1) { super(name1,address1,phone,email1,office1,salary1);
title = title1; type = "Faculty"; } public String toString() { return (super.toString() + "Title: " + title); }
}


public class Tester { public static void main(String args[]) { Person person1 = new Person("George", "1441 Somewhere lane",7041075, "fakeguy@cox.net"); Student student1 = new Student("Bob", "1341 Somewhere lane",7041275, "fakeguy2@cox.net", 1); Employee employee1 = new Employee("Frank", "1421 Somewherelane", 704133, "fakeguy3@cox.net","Office1", 5000); Faculty faculty1 = new Faculty("Roberta", "2421 Somewherelane", 604133, "fakeguy4@cox.net","Office3", 10000, "10:00 - 3:00","Teacher"); Staff staff1 = new Staff("Dora", "3421 Somewhere lane",404133, "fakeguy6@cox.net","Office2", 700, "Substitute"); System.out.println(person1.toString()); System.out.println(student1.toString()); System.out.println(employee1.toString()); System.out.println(faculty1.toString()); System.out.println(staff1.toString()); }
}

public class Tester { public static void main(String args[]) { Person person1 = new Person("George", "1441 Somewhere lane",7041075, "fakeguy@cox.net"); Student student1 = new Student("Bob", "1341 Somewhere lane",7041275, "fakeguy2@cox.net", 1); Employee employee1 = new Employee("Frank", "1421 Somewherelane", 704133, "fakeguy3@cox.net","Office1", 5000); Faculty faculty1 = new Faculty("Roberta", "2421 Somewherelane", 604133, "fakeguy4@cox.net","Office3", 10000, "10:00 - 3:00","Teacher"); Staff staff1 = new Staff("Dora", "3421 Somewhere lane",404133, "fakeguy6@cox.net","Office2", 700, "Substitute"); System.out.println(person1.toString()); System.out.println(student1.toString()); System.out.println(employee1.toString()); System.out.println(faculty1.toString()); System.out.println(staff1.toString()); }
}
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote