package employeeStuff; public class PieceWorkEmployee extends PermanentEmployee { private int numberProduced; private double costPerPiece; /** * constructor from parameters */ public PieceWorkEmployee(String id,String first, String last, int number, double cost) { super(id,first,last); numberProduced = number; costPerPiece = cost; } // access functions /** * @return the number produced */ public int getNumberProduced() { return numberProduced; } /** * @return the cost per piece */ public double getCostPerPiece() { return costPerPiece; } // mutators /** * sets the number produced */ public void setNumberProduced(int n) { numberProduced = n; } /** * sets the cost per piece */ public void setCostPerPiece(double c) { costPerPiece = c; } /** * @return the pay check computation */ public double pay() { return numberProduced * costPerPiece - getBenefitDeduction(); } /** * overrides toString() * @return data as a String */ public String toString() { return super.toString() + "Piecework Employee\nNumber Produced: " + numberProduced + " CostPerPiece: " + costPerPiece + " "; } } // end PieceWorkEmployee