You are on page 1of 1

Assessment program:

Create a base class named Employee that contains name and number and
yearOfHire instance variables. From this class derive a class named
ProductionEmployee, (ie extend Employee) having an additional instance variable
named baseHourlyPayRate.

The Employee class should have


a constructor that initialises the instance variables to values obtained from
the user,
getter and setter methods for the instance variables.

The ProductionEmployee class should have


A constructor that initialises the instance variable to the value obtained from
the user,
Getter and setter methods for the instance variable
A calcPayRate() method that does the following
o Gets the yearOfHire from the Employee class and subtracts this from
the current year to get years of service
o Using a for loop add $1 to the baseHourlyPayRate for every year of
service
o Return this value
Write a driver program to test the instantiable classes.

An Employee (management level) has been hired


prompt the user for name, number (an integer from 1 to 9999) and hire year
(an integer greater than 1999 the company began in 2000).
Create an Employee object.

A ProductionEmployee has been hired


prompt the user for name, number (an integer from 1 to 9999) and hire year
(an integer greater than 1999) and base hourly pay rate (minimum pay $10
per hour).
Create a ProductionEmployee object

Now display
The management employee information
The production employee information

It seems the production employee had worked at the organisation before. His hire
date needs to be changed to 2004. Use the setter to do this. Now display this
persons information including base and actual hourly pay rate.

You might also like