Answer:
se explaination
Explanation:
//Design a class named Person
public class Person
{
//A person has a name, address, phone number, and email address.
String name;
String address;
String phone;
String email;
//Constructor with arguments
public Person(String pname,String paddress,String phNum,String pemail)
{
name=pname;
address=paddress;
phone=phNum;
email=pemail;
}
// toString() method to return the name
public String toString()
{
return getClass().getName()+" "+name;
}
}
---------------------------------------------------------
//Student.java
public class Student extends Person
{
//A student has a class status
//(freshman,sophomore, junior, or senior).
//Define the status as a constant.
final int freshman =1;
final int sophomore =2;
final int junior=3;
final int senior=4;
String status="freshman";
//Constructor with arguments
public Student(String name, String address,String phonenumber, String email, int Status)
{
super(name,address,phonenumber,email);
if(Status == 1)
{
status = "freshman";
}
if(Status == 2)
{
status = "sophomore";
}
if(Status == 3)
{
status = "junior";
}
if(Status == 4)
{
status = "Senior";
}
status = "Student";
}
public String toString()
{
return super.toString() + " " + status;
}
}
------------------------------------------------------
//Employee.java
public class Employee extends Person
{
//An employee has an office, salary, and date hired.
String office;
double salary;
java.util.Date dateHired;
//Constructor with arguments
public Employee(String name,String address,String phonenumber,String email,String off,double sal)
{
super(name,address,phonenumber,email);
office=off;
salary=sal;
}
public String toString()
{
return (super.toString() + " " + office +" " + salary);
}
}
--------------------------------------------------------
//Faculty.java
public class Faculty extends Employee
{
//A faculty member has office hours and a rank.
String officeHours;
String rank;
//Constructor with arguments
public Faculty(String name,String address,String phonenumber,String email,String off,int salary,String offHours,String ranks)
{
super(name,address,phonenumber,email,off,salary);
officeHours=offHours;
rank=ranks;
}
public String toString()
{
return (super.toString() + " " + officeHours +" " + rank);
}
}
-----------------------------------------------------------------------------
//Staff.java
public class Staff extends Employee
{
//A staff member has a title
String title;
//Constructor with arguments
public Staff(String name,String address,String phonenumber,String email,String off,int salary,String ti t)
{
super(name,address,phonenumber,email,off,salary);
title=ti t;
}
public String toString()
{
return (super.toString() + " " + title);
}
}