Question: //Employee.java package com.emp.pay.bb; public class Employee { private String name; private String address; private String SIN; public String getName() { return name; } public void

 //Employee.java package com.emp.pay.bb; public class Employee { private String name; private

//Employee.java

package com.emp.pay.bb;

public class Employee { private String name; private String address; private String SIN; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getSIN() { return SIN; } public void setSIN(String SIN) { this.SIN = SIN; } }

// Hourly Employee.java

package com.emp.pay.bb; public class HourlyEmployee extends Employee{ private double wage; private double hours; public void setWage(double wage) { this.wage = wage; } public double getWage() { return wage; }

public void setHours(double hours) { this.hours = hours; } public double getHours() { return hours; }

public double hourlyEmployeeEarnings() { double hSalary = 0; if(getHours() = 40) { hSalary = 40*getWage()+(getHours()-40)*getWage()*1.5; } return hSalary; } }

//PieceWorkerEmployee.java

package com.emp.pay.bb; public class PieceWorkerEmployee extends Employee {

private double wagePerPiece; private int numberOfPiecesOfMerchandise;

public void setWagePerPieces(double wagePerPiece) { this.wagePerPiece = wagePerPiece; } public double getWagePerPieces() { return wagePerPiece; }

public void setNumberOfPiecesOfMerchandise(int numberOfPiecesOfMerchandise) { this.numberOfPiecesOfMerchandise = numberOfPiecesOfMerchandise; }

public int getNumberOfPiecesOfMerchandise() { return numberOfPiecesOfMerchandise; } public double pieceWorkerEmployeeEarnings() { return (getWagePerPieces()+getWagePerPieces()*.01)*getNumberOfPiecesOfMerchandise(); } }

// Salaried Employee.java

package com.emp.pay.bb; public class SalariedEmployee extends Employee{ private double weeklySalary; public void setWeeklySalary(double weeklySalary) { this.weeklySalary = weeklySalary; } public double getWeeklySalary() { return weeklySalary; }

public double salariedEmployeeEarnings() { return getWeeklySalary(); } }

//Base Salaried Commision EMployee

package com.emp.pay.bb;

public class BaseSalariedCommissionEmployee extends CommissionEmployee {

private double baseSalary;

public void setBaseSalary(double baseSalary) { this.baseSalary = baseSalary; }

public double getBaseSalary() { return baseSalary; } public double baseSalariedCommissionEmployeeEarnings() { return (getCommissionRate()*getGrossSales())+getBaseSalary(); } }

//Comission Employee.java

package com.emp.pay.bb;

public class CommissionEmployee extends Employee {

private double commissionRate; private double grossSales; public double getCommissionRate() { return commissionRate; }

public void setCommissionRate(double commissionRate) { this.commissionRate = commissionRate; }

public double getGrossSales() { return grossSales; }

public void setGrossSales(double grossSales) { this.grossSales = grossSales; } public double commissionEmployeeEarnings() { return commissionRate*grossSales; } }

//Tasks

// Create CompanyEmployeePayrollTest.java in the above uploaded solution.

// Write test cases for each method ( including getter and setter methods ) in CompanyEmployeePayrollTest.java.

// If you run CompanyEmployeePayrollTest.java, all the test cases should pass.

Objective: The objective of this assignment is to write unit test cases using JUnit. Assignment Specification: A company wants you to write an application that performs its payroll calculations. Requirement specifica- tions are given below: A company pays its employees on a weekly basis. The employees are of five types: Salaried employees are paid a fired weekly salary regardless of the number of hours worked, hourly employees are paid by the hour and receive overtime pay (i.e., 1.5 times their hourly salary rate) for all hours worked in excess of 40 hours, commission employees are paid a percentage of their sales and base-salaried commission employees receive a base salary plus a percentage of their sales, piece worker employees are paid based on the number of pieces of merchandise produced. For the current pay period, the company has decided to reward salaried-commission employees by adding 10% to their base salaries and piece Worker employees by adding 1% to their wage per piece. A sample solution of this problem is uploaded on Blackboard. So you do not need to write/use your own solution. Use the uploaded solution and perform the following tasks: (54 points) Create CompanyEmployeePayrollTest.java in the above uploaded solution. Write test cases for each method (including getter and setter methods ) in CompanyEmployeePayrollTest.java. If you run Company EmployeePayroll Test.java, all the test cases should pass

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!