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

Java Programming Design a class named Person and its two subclasses named Studen

ID: 3803838 • Letter: J

Question

Java Programming Design a class named Person and its two subclasses named Student and 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, date hired. Define a class named MyDate that contains the fields year, month, and day Overridde the toString method in each class to display the class name and the person's name. Draw the UML diagram for classes and implement them. Write a test program that creates a Person, Student and Employee and invokes their toString() methods.

Explanation / Answer

public class person {    private String name, address, phone, email; public person(){ } public person(String name, String address, String phone, String email){ this.name = name; this.address = address this.phone = phone; this.email = email; } 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 String getPhone(){ return phone; } public void setPhone(String phone){ this.phone = phone; } public String getEmail(){ return phone; } public void setEmail(String email){ this.email = email; @Override public String toString(){ return getClass().getName() + " " + name; } } public class student extends person{    private final String CLASS_STATUS; public student(String CLASS_STATUS){ this.CLASS_STATUS =CLASS_STATUS; } public String getClassStatus(){ return CLASS_STATUS; } } public class employee extends person{ private String office,salary; private MyDate DATE_HIRED; public employee(){ } public employee(String office, String salary, MyDate DATE_HIRED){ this.office = office; this.salary = salary; this.DATE_HIRED = DATE_HIRED; } public String office(){ return office; } public void setOffice(String office){ this.office = office; } public String getSalary(){ return salary; } public void setSalary(String salary){ this.salary = salary; } public MyDate getMyDate(){ return DATE_HIRED; } } public class MyDate{ private int month, day, year;    public MyDate(int month, int day, int year){ this.day = day; this.month =month; this.year = year; } }

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