Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Concepts Tested in this Program : ? Class Design ? Constructors ? Objects ? Inheritance Program: Design a class named Person and its two subclasses,

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions