CS计算机代考程序代写 b’ea3cf9a3f67e648870eaa7a8aecc1e2a1b1931′

b’ea3cf9a3f67e648870eaa7a8aecc1e2a1b1931′

blob 1301�package programmingexample7;

public class SalesPerson extends Employee {

private float commission;
private double salesTarget;
private double salesAchieved;

public SalesPerson(String title, String firstName, String lastName, int quota) {
super(title, firstName, lastName);
this.salesTarget = quota;
}

public double calculateSalary() {
double totalSal;
totalSal = super.getBaseSalary() + commission * getSalesAchieved()
+ super.calculateParkingFringeBenefits()
– super.calculateTax();
return totalSal;
}

public double getSalesTarget() {
return salesTarget;
}

public double getSalesAchieved() {
return salesAchieved;
}

@Override
public double getBonus() {
return commission * getSalesAchieved();
}

// Code Smells: Inappropriate Intimacy and Lazy class
// getSalesSummary was accessing the methods of class Employee from SalesHistory
// Once getSalesSummary() is moved, SalesHistory does not do anything, becomes a lazy class
public String getSalesSummary() {
return getFirstName() + getLastName() + “Sales Target: ” + getSalesTarget() + “$\n” +
“Sales to date: ” + getSalesAchieved() + “$”;
}

}