QuestionQuestion

Assignment 5: Inheritance
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 PreviewSolution 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.

50% discount

Hours
Minutes
Seconds
$25.00 $12.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats