Uploaded by bsef20m542

03 Lab - Morning

advertisement
Web Engineering Lab
Lab 03
W e b
E n g i n e e r i n g
Lab 03
Marks 100
Instructions
Work on this lab individually.
You can use your books, notes, handouts etc. but you are not allowed to borrow anything from your peer student.
Objectives
Today’s lab will help you to refresh your programming concepts in Java, including inheritance, abstract classes and use of interfaces
in java.
Submission
Required within Lab
What you have to do
Program the following tasks in Java, compile and execute them. The name of your files will be according to the task given in this lab.
Task 1
[70]
A company pays its employees on a weekly basis. The employees are of four types: Salaried employees are paid a fixed weekly
salary regardless of the number of hours worked, hourly employees are paid by the hour and receive overtime pay (i.e., 1.5 times
their hourly salary rate) for all hours worked in excess of 40 hours, commission employees are paid a percentage of their sales and
base-salaried commission employees receive a base salary plus a percentage of their sales. For the current pay period, the company
has decided to reward salaried-commission employees by adding 10% to their base salaries. The company wants to write an
application that performs its payroll calculations polymorphically.
Graphically draw the complete hierarchy of your proposed solution (in your notebook), and implement it in Java using the concepts
of abstract classes/interfaces.
Each employee, regardless of the way his or her earnings are calculated, has a first name, a last name and a social security number
(SSN), so private instance variables firstName, lastName and SSN appear in superclass. You need to override toString() method in
each class to display the employee’s basic information.
Task 2
[30]
Write an interface StudentData which include following function declarations:
 setName()
 setRollNumber()
 setCGPA()
 getName()
 getRollNumber()
 getCGPA()
 display()
Write a subclass Student which will implement all these functions. Create the object of the class with the help of reference variable
of interface and make calls to all the functions polymarphically.
   BEST OF LUCK   
Hassan Khan, PUCIT – PU.
Page 1 of 1
Download