Question
Assignment 5: Using the payroll weekly paycheck calculator scenario as a model, you will create a superclass and subclasses (exclude any dates and the date class from the last assignment).
The superclass should contain fields for common user data for an employee (first name and last name) and a toString method that returns the formatted output of the names to the calling method. Three subclasses should be created that all inherit from the superclass: one for a salaried employee, one for an hourly employee and one for a commission employee. Subclasses should call the superclass constructor within their constructor to set their instance variables (names). Each subclass should have an additional instance variable for the weekly pay that they calculate. Each subclass should have a toString method that prints the calculated weekly paycheck from the class plus calls the toString method of the superclass to obtain the formatted first and last name. Create a basic driver class to supply input into the program so that you create one object of each payroll type. You must supply data to create an object of all subclasses. Print the results as you did in previous assignments. The results must be correct.
Solution Preview
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.
package payroll;public class CommissionEmployee extends Employee {
private double commissionAmount;
private double weeklyPaycheck;
public CommissionEmployee(String firstName, String lastName,
double commissionAmount) {
super(firstName, lastName);
this.commissionAmount = commissionAmount;
}
public double getCommissionAmount() {
return commissionAmount;
}
public void setCommissionAmount(double commissionAmount) {
this.commissionAmount = commissionAmount;
}
public double getWeeklyPaycheck() {
return weeklyPaycheck;
}
public void setWeeklyPaycheck(double weeklyPaycheck) {
this.weeklyPaycheck = weeklyPaycheck;
}
public void calculatePaycheck() {
weeklyPaycheck = 200 + commissionAmount...
By purchasing this solution you'll be able to access the following files:
Solution.zip.