Thursday, November 3, 2011

Java: simple task. Can you do it?





Consider a situation where we have a superclass Worker and subclassses PartTimeWorker and FullTime Worker. Every worker has a name and a salary rate. Write a method that computes the weekly pay for every worker. A part-time worker gets paid the hourly wage for the actual number of hours worked, if the hours are 40 or less. If the part-time worker works more than 40 hours, the excess is paid at time and a half. The full-time worker gets paid the hourly wage for 40 hours, no matter what the actual number of hours worked. Develop and test this program by demonstrating the use of inheritance and polymorphism.
Post a Comment