Question: Create a class named Employee with private name and a salary data fields, a toString method to print the data, and get and set methods
Create a class named Employee with private name and a salary data fields, a toString method to print the data, and get and set methods for the two private data items. Create another class named Manager with a field named department that inherits from the Employee class. Include a toString() method that prints the managers name, department, and salary. Create a third class named Director that inherits from the Manager class and has a field named stipendAmount. Supply the toString() method for Director that prints all of its instance variables. Also, write a main program named myOutput that instantiates separate objects using each of the classes and invokes the toString() method to print out each of its instance variables.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
