Java
(The Person, Student, Employee, Faculty, and Staff classes) 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 e-mail 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. Use the MyDate class defined below to create an object for date
hired. A faculty member has office hours and a rank. A staff member has a title. Override the
toString method in each class to display the class name and the persons name.
File name: MyDate.java
//Import date package for Date class
import java.util.Date;
class MyDate {
int year; int month; int day;
public MyDate() {
long timein_Sec=System.currentTimeMillis();
Date currentDate=new Date( timein_Sec);
year=currentDate.getYear()+1900;
month=currentDate.getMonth()+1;
day=currentDate.getDate();
System.out.println("current Time HH:MM:SS "+ currentDate.getHours()
+":" +currentDate.getMinutes()+":" +currentDate.getSeconds());
}
public MyDate(int MM,int DD,int YYYY) {
year=YYYY; day=DD; month=MM;
}
public MyDate(long elapTime) {
Date userDate=new Date(elapTime);
year=userDate.getYear()+1900;
month=userDate.getMonth()+1;
day=userDate.getDate();
System.out.println("User Date Time HH:MM:SS "+ userDate.getHours()
+ ":"+userDate.getMinutes()+ ":"+userDate.getSeconds());
}
public void setDate(long elapsedTime){
Date currentDate=new Date(elapsedTime);
year=currentDate.getYear()+1900;
month=currentDate.getMonth()+1;
day=currentDate.getDate();
}
public int getYear() {
return year;
}
int getMonth()
{
return month;
}
public int getDay() {
return day;
}
}

Java The Person Student Employee Faculty and Staff clas.pdf

  • 1.
    Java (The Person, Student,Employee, Faculty, and Staff classes) 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 e-mail 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. Use the MyDate class defined below to create an object for date hired. A faculty member has office hours and a rank. A staff member has a title. Override the toString method in each class to display the class name and the persons name. File name: MyDate.java //Import date package for Date class import java.util.Date; class MyDate { int year; int month; int day; public MyDate() { long timein_Sec=System.currentTimeMillis(); Date currentDate=new Date( timein_Sec); year=currentDate.getYear()+1900; month=currentDate.getMonth()+1; day=currentDate.getDate(); System.out.println("current Time HH:MM:SS "+ currentDate.getHours() +":" +currentDate.getMinutes()+":" +currentDate.getSeconds()); } public MyDate(int MM,int DD,int YYYY) { year=YYYY; day=DD; month=MM; } public MyDate(long elapTime) { Date userDate=new Date(elapTime); year=userDate.getYear()+1900; month=userDate.getMonth()+1; day=userDate.getDate(); System.out.println("User Date Time HH:MM:SS "+ userDate.getHours() + ":"+userDate.getMinutes()+ ":"+userDate.getSeconds()); } public void setDate(long elapsedTime){ Date currentDate=new Date(elapsedTime); year=currentDate.getYear()+1900; month=currentDate.getMonth()+1; day=currentDate.getDate(); } public int getYear() { return year;
  • 2.
    } int getMonth() { return month; } publicint getDay() { return day; } }