Every salesperson has a basic salary. The salesperson also receives a bonus at t
ID: 3531771 • Letter: E
Question
Every salesperson has a basic salary. The salesperson also receives a bonus at the end of each month, based on the following criteria:
If the salesperson has been with the store for five years or less, the bonus is $10 for each year that he or she has worked there. If the salesperson has been with the store for more than five years, the bonus is $20 for each year that he or she has worked there.
The salesperson can earn additional bonus as follow:
If the total sale made by the salesperson for the month are greater than or equal to $5,000 but less tan $10,000, he or she receives a 3% commission on the sale. I
If the total sales made by the salesperson for the month are $10,000 or more, he or she receives a 6% commission on the sale.
Explanation / Answer
public class SalesPerson {
private String name;
private double salary;
private double sales;
private double commission;
public SalesPerson(String name, double salary, double sales, double commission) {
super();
this.name = name;
this.salary = salary;
this.commission = commission;
this.sales = sales;
}
public double getTotalCompensation() {
return salary + (sales* commission / 100);
}
@Override
public String toString() {
return "SalesPerson [name=" + name + ", salary=" + salary + ", sales="
+ sales + ", commission=" + commission + ", total compenstion is :" + getTotalCompensation() + "]";
}
public static void main(String args[]) {
SalesPerson sp = new SalesPerson("Adams", 20000, 130000, 3.5);
System.out.println(sp.toString());
}
}
output:
SalesPerson [name=Adams, salary=20000.0, sales=130000.0, commission=3.5, total compenstion is :24550.0]
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.