class named person java code ????
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 has a class status (freshman, sophomore, junior, or senior). Define the status as a final Stringvariable .
An Employee has an office number , salary (both ints ), and a date hired. Use the MyDate class defined below to create an object for date hired:class MyDate{privateString date; //date in the form mm/dd/yy
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’d to create as well as what information they’d like it to have. The program then uses the object ‘s toString method to print information about that object .
SAMPLE RUN #1
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java Driver Enter 1)To create a student 2)To create an employee: 1 Enter name : Walter D. Graham Enter address: 4737 Stadium Drive Whitinsville, MA 01588 Enter phone number: 508-266-2108 Enter email: walterdgraham@university.edu Enter student’s status: Junior Student: Walter D. Graham Status: Junior Address: 4737 Stadium Drive Whitinsville, MA 01588 Phone Number: 508-266-2108 Email Address: walterdgraham@university.edu
SAMPLE RUN #2
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
Office Hours: 5-7pm, Mon-Thu Office: 724 Address: 795 University Hill Road Decatur, IL 62522 Phone Number: 217-519-6747 Email: kimdavis@school.edu
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java Driver Enter 1)To create a student 2)To create an employee: 2 Enter name : Kimberly D. Davis Enter address: 795 University Hill Road Decatur, IL 62522 Enter phone number: 217-519-6747 Enter email: kimdavis@school.edu Enter 1)To create a faculty member 2)To create a staff member: 1 Enter office number: 724 Enter salary: 84101 Enter date hired (mm/dd/yy): 06/12/92 Enter office hours: 5-7pm, Mon-Thu Enter rank: Adjunct Professor Faculty: Kimberly D. Davis Rank: Adjunct Professor Salary: $84101 Date Hired: 06/12/92
Office Hours: 5-7pm, Mon-Thu Office: 724 Address: 795 University Hill Road Decatur, IL 62522 Phone Number: 217-519-6747 Email: kimdavis@school.edu
SAMPLE RUN #3
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
Office: 206 Address: 4249 Camden Place Isle Of Palms, SC 29451 Phone Number: 843-883-0082 Email: jonnym@theschool.edu
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java Driver Enter 1)To create a student 2)To create an employee: 2 Enter name : Jonathan A. Montgomery Enter address: 4249 Camden Place Isle Of Palms, SC 29451 Enter phone number: 843-883-0082 Enter email: jonnym@theschool.edu Enter 1)To create a faculty member 2)To create a staff member: 2 Enter office number: 206 Enter salary: 53102 Enter date hired (mm/dd/yy): 12/06/55 Enter title: Chair of Physics Department Staff: Jonathan A. Montgomery Salary: $53102 Date Hired: 12/06/55
Office: 206 Address: 4249 Camden Place Isle Of Palms, SC 29451 Phone Number: 843-883-0082 Email: jonnym@theschool.edu
SAMPLE RUN #4
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java Driver Enter 1)To create a student 2)To create an employee: 1 Enter name : Rebecca M. Garrison Enter address: 505 Freed Drive Stockton, CA 95202 Enter phone number: 209-768-3575 Enter email: rgarrison@thisuniversity.edu Enter student’s status: Sophomore Student: Rebecca M. Garrison Status: Sophomore Address: 505 Freed Drive Stockton, CA 95202 Phone Number: 209-768-3575 Email Address: rgarrison@thisuniversity.edu
SAMPLE RUN #5
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
Office Hours: 8-9am Sat-Sun Office: 397 Address: 4689 Wal Nuzum Farm Road Penfield, NY 14526 Phone Number: 585-388-1198 Email: sharsing@uni.edu
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java Driver Enter 1)To create a student 2)To create an employee: 2 Enter name : Sharon A. Singleton Enter address: 4689 Wal Nuzum Farm Road Penfield, NY 14526 Enter phone number: 585-388-1198 Enter email: sharsing@uni.edu Enter 1)To create a faculty member 2)To create a staff member: 1 Enter office number: 397 Enter salary: 82134 Enter date hired (mm/dd/yy): 04/21/45 Enter office hours: 8-9am Sat-Sun Enter rank: Tenured Professor Faculty: Sharon A. Singleton Rank: Tenured Professor Salary: $82134 Date Hired: 04/21/45
Office Hours: 8-9am Sat-Sun Office: 397 Address: 4689 Wal Nuzum Farm Road Penfield, NY 14526 Phone Number: 585-388-1198 Email: sharsing@uni.edu
SAMPLE RUN #6
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
Office: 162 Address: 401 Kenwood Place Pompano Beach, FL 3306 Phone Number: 954-530-4906 Email: cpholt@school.edu
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java Driver Enter 1)To create a student 2)To create an employee: 2 Enter name : Cynthia P. Holt Enter address: 401 Kenwood Place Pompano Beach, FL 3306 Enter phone number: 954-530-4906 Enter email: cpholt@school.edu Enter 1)To create a faculty member 2)To create a staff member: 2 Enter office number: 162 Enter salary: 51259 Enter date hired (mm/dd/yy): 07/18/85 Enter title: Dean of Faculty Staff: Cynthia P. Holt Salary: $51259 Date Hired: 07/18/85
Office: 162 Address: 401 Kenwood Place Pompano Beach, FL 3306 Phone Number: 954-530-4906 Email: cpholt@school.edu