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, Student

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

1. To Create a Student.

2. To Create an Employee.

Choice 1:

Enter a name: ABC

Enter ABC's address: XYZ

Enter ABC's phone number: 123

Enter ABC's email address: qweat

Enter ABC's class status: Junior

Student: ABC

Status: Junior

Address: XYZ

Phone Number: 123

Email Address: qweat

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

Describe how to perform resource leveling.

Answered: 1 week ago

Question

=+ Are ballots compulsory?

Answered: 1 week ago