Question: Objectives: In this lab, the following topic will be covered: 1. Inheritance Task Design a class Person that has two subclasses Student and Employee. A

Objectives: In this lab, the following topic will be covered: 1. Inheritance Task Design a class Person that has two subclasses Student and Employee. A person has a name and a phone number. A student has an id and GPA. An employee has an id and monthly salary. Note: All instance variables must be declared as private. Include in each class a constructor that has all the data fields. In each class override the tostring( ) method to return the data fields. For the Person class include getter and setter for phone number and a getter for name. For the Student class include getter and setter for GPA. For the Employee class include getter and setter for monthly salary. Note: For the setters assume that the parameters are valid. Write a test program that creates three objects: a Person object referenced by person, a Student object referenced by student, and an Employee object referenced by employee. Display the details of each object using its toString( ) method. Here is a sample run of the program: Name: Salem, Phone number: 0501331845 Name: Reem, Phone number: 0564448202, ID: 200000, GPA: 3.6 Name: Saad, Phone number: 0563428255, ID: 200003, Monthly salary: 16000 SAR
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
