0% found this document useful (0 votes)
42 views

CSCI213 Spring2013 Workshops Lab 6

This document provides instructions for a programming assignment involving classes, interfaces, and object-oriented concepts in Java. Students are asked to [1] create an Employee class with get/set methods and constructors, [2] create an interface for promotion raises, [3] create a Manager class that extends Employee and implements the interface, overriding methods and adding new ones, and [4] write a driver class to test the classes by creating Manager objects and calling their methods.

Uploaded by

ami_haroon
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

CSCI213 Spring2013 Workshops Lab 6

This document provides instructions for a programming assignment involving classes, interfaces, and object-oriented concepts in Java. Students are asked to [1] create an Employee class with get/set methods and constructors, [2] create an interface for promotion raises, [3] create a Manager class that extends Employee and implements the interface, overriding methods and adding new ones, and [4] write a driver class to test the classes by creating Manager objects and calling their methods.

Uploaded by

ami_haroon
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

University of Wollongong in Dubai Spring 2013 CSCI 213 - Lab 6 Week 7 Topics: Interfaces

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.

You might also like