Question
Java Project # 8 Concepts Tested in this Program: ? Class Design ? Constructors ? Objects ? Inheritance Program: Design a class named Person and
Java Project # 8
Concepts Tested in this Program:
? Class Design
? Constructors
? Objects
? Inheritance
Program:
Design a class named Person and its two subclasses, Student and Employee. Make Faculty and Staff subclasses of Employee.
A Person object has a name, address, phone number, and email address (all Strings).
A Student Object has a class status (freshman, sophomore, junior, or senior). Define the status as a final String variable.
An Employee Object has an office number, salary (both ints ), and a date hired. Use the MyDate class defined below to create an object for date hired:
public class MyDate {
private String date;
public MyDate(String date){
this.date = date;
}
public String getDate() {
return date;
}
}
A Faculty object has office hours and a rank (both Strings), while a Staff object has a title (as a String).
For the Student, Faculty, and Staff classes, create toString methods that store information about the object (in the format shown in the examples below).
Test your classes in a Driver class (within the same file) that asks the user what type of object they would like to create as well as what information they would like it to have.
The program should then use the object's toString method to print information about that object.
Sample Run #1
Sample Run #2
1) to create a student 2) to create an Employee Choice: 1 Enter a name: Walter D. Graham Enter Walter D. Graham's adress: 4737 Stadium Drive, Orangville, MA, 01588 Enter Walter D. Graham's email: valtergrahameuniversity.edu Enter Walter D. Graham s class Status Junior Student: Walter D. Graham Status: Junior Address: 4737 Stadium Drive, Orangville, MA, 01588 Phone number: 508-266-2108 Email Address: waltergraham@university.edu
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started