Write a class named Employee which implements Comparable Interface with name and salary as data fields Add a constructor with argument name and salary. Add getter and Setter for name and salary. Add CompareTo() method for the data Salary. 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) Add the above 3 objects into an ArrayLIst object and Sort by Salary and Display. Create an object Employee class with (Zayed, 500,IT) and 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 fields
Add a constructor with argument name and salary. Add getter and Setter for name and salary.
Add CompareTo() method for the data Salary.
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)
Add the above 3 objects into an ArrayLIst object and Sort by Salary and Display.
Create an object Employee class with (Zayed, 500,IT) and display the 1. Name 2. Salary 3. Department by using tostring() method.
Step by step
Solved in 2 steps with 3 images