英语java书上的另外一道题目

来源:百度知道 编辑:UC知道 时间:2024/07/04 13:09:05
Design a class named Person and its two subclasses named Student and Employee. 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 an office, salary, and date-hired (date-hired is of MyDate type described below).

· A faculty member has office hours and a rank (Lecturer, Assistance Prof., Associate Prof. and Professor). Define rank as a constant.

· A staff member has a title.

· Define a class named MyDate that contains the fields year, month, and day.

· Add at least one constructor of your choice in each class.

· Override the toString method in each class to display the class name and the string representation of the object.

· Exc

写了一下 你可以参考一下
package practice;

public class Person {
private String name;
private String address;
private int phone_number;
private String email_address;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public int getPhone_number() {
return phone_number;
}

public void setPhone_number(int phone_number) {
this.phone_number = phone_number;
}

public String getEmail_address() {
return email_address;
}

public void setEmail_address(String email_address) {
this.email_address = email_address;
}

}

package practice;

public class Student extends Person{