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. (15 points) 4. Add overloaded constructors to the Employee and Manager classes where you to pass the name and salary using the Employee constructor and pass the name, salary, and department to the Manager constructor. Write a test class to instantiate a manager object and display its contents. (15 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started