Java Homework:(The Person, Student, Employee, Faculty , and Staff classes) Design a class named Person and its
Fantastic news! We've Found the answer you've been seeking!
Question:
Java Homework:(The Person, Student, Employee, Faculty, and Staff 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 an office, salary, and date-hired. Define a class named MyDate that contains the fields year, month, and day. 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 person's name.
class Person{ //A person has a name, address, phone number, and email address. String name; String address; String phone; String email; rn} rnclass 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; int status=freshman; rn} rnclass Employee extends Person{ //An employee has an office, salary, and date hired. String office; double salary; java.util.Date dateHired; rn} rnclass Faculty extends Employee{ //A faculty member has office hours and a rank. String officeHours; String rank; }rn class Staff extends Employee{ //A staff member has a title String title; rn} rnpublic class ex112{ }
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date: