Write a class named Employee which implements Comparable Interface with name and salary as data field. Add a constructor with argument name and salary. Add getter and Setter for name and salary. Add CompareTo() method for the data Name. Write a class named Manager which inherits the Employee class. Add an instance variable, named department, of type String. Add a constructor in the subclass class with arguments name, salary, department and a toString() method that prints the manager’s name, department, and salary [Hint: Add a toString( ) method in the super class as well] Create 3 objects of Manager with following arguments 1. (Zayed, 500), 2. ( Ahmed, 700) 3. ( Faisal, 600) Create an Array object Add the above 3 objects into an Array object and Sort by Name and Display Create an object Employee class with argument (Zayed, 500, IT) Display the 1. Name 2. Salary 3. Department by using tostring() method.
Write a class named Employee which implements Comparable Interface with name and salary as data field.
Add a constructor with argument name and salary. Add getter and Setter for name and salary.
Add CompareTo() method for the data Name.
Write a class named Manager which inherits the Employee class. Add an instance variable, named department, of type String.
Add a constructor in the subclass class with arguments name, salary, department and a toString() method that prints the manager’s name, department, and salary [Hint: Add a toString( ) method in the super class as well]
Create 3 objects of Manager with following arguments
1. (Zayed, 500), 2. ( Ahmed, 700) 3. ( Faisal, 600)
Create an Array object
Add the above 3 objects into an Array object and Sort by Name and Display
Create an object Employee class with argument (Zayed, 500, IT)
Display the 1. Name 2. Salary 3. Department by using tostring() method.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images