Lab 08
Lab 08
Lab 08
Lab Assignment 08
2020 – 2021 Spring, CMPE 211 Fundamentals of Programming II
1
Computer Engineering Department
It has two instance variables (in addition to those inherited): one is the total sales the employee has
made (type double) and the second is the discount rate for the employee (the discount rate will be
type double and will represent the percent (in decimal form) discount the employee applies on
sales (so .2 would mean the employee applies 20% discount on sales)).
The constructor takes 6 parameters: the first 5 are the same as for Hourly (name, address, phone
number, social security number, hourly pay rate) and the 6th is the discount rate for the employee.
The constructor should call the constructor of the parent class with the first 5 parameters then use
the 6th to set the discount rate.
One additional method is needed: public void addSales (double totalSales) that
adds the parameter to the instance variable representing total sales.
The pay method must call the pay method of the parent class to compute the pay for hours
worked then subtracts to that the pay from discount on sales. (See the pay method in the
Executive class.) The total sales should be set back to 0 (note: you don’t need to set the hours
Worked back to 0—why not?).
The toString method needs to call the toString method of the parent class then add the total
sales to that.
Submission
You need to implement all the required tasks above and upload your Java source files (.java) as a single Zip
file into the available Moodle submission.