CSCI213 Spring2013 Workshops Lab 6
CSCI213 Spring2013 Workshops Lab 6
TASK 1
1. Write a program to store the following information for the employee in an organisation: employee id, employee name, basic salary a. Create two constructors for the class i. Constructor without arguments ii. Constructor with arguments (parameterized constructor) 2. Write a method getData to get the all the required information about the employee from the user. (Use Scanner class) 3. The class should also contain a method displayDetails to display the details of the employee. This function does not return anything. 4. Consider the following Interface //increments salary by INC only if the existing salary is <5000 public interface Promotion { public final int INC=2000; public void increment(); } 5. Create a class Manager that is derived from the class Employee and also implements the interface Promotion. The class Manager has additional attributes: transport allowance, bonus, total salary and tax deduction 6. Methods getData , displayDetails are overridden in Manager class (also invoke getData, displayDetails of the Employee class). Also define a method calSal to calculate the salary (transport allowance + basic salary + bonus - tax deduction) 7. bool searchId(int id) will return true if the id matches the id of the object calling the function. 8. Create two constructors for the Manager class a. Constructor without arguments b. Constructor with arguments (parameterized constructor) 9. Create a driver class having an array of 5 objects of the class Manager. Give a call to all the methods in the correct order. 10. Prompt the user to enter the id to be searched. Search for the id in the array using the function searched(int id). If a manger exists with the given id, then display appropriate message along with the location of the object in the array. 11. Create a reference of type promotion and assign an object of class manager and call all the methods in the manager class using the previously mentioned reference.