Modify the Week Two console based, non-GUI Java application using NetBeans IDE t
ID: 3839797 • Letter: M
Question
Modify the Week Two console based, non-GUI Java application using NetBeans IDE to meet these additional and changed business requirements: The company has recently changed its total annual compensation policy to improve sales. A salesperson will continue to earn a fixed salary of $24000. The current sales target for every salesperson is $120000. The sales incentive will only start when 80% of the sales target is met. The current commission is 4.2% of total sales. If a salesperson exceeds the sales target, the commission will increase based on an acceleration factor. The acceleration factor is 1.6. The application should ask the user to enter annual sales, and it should display the total annual compensation. The application should also display a table of potential total annual compensation that the salesperson could have earned, in $5000 increments above the salesperson's annual sales, until it reaches 50% above the salesperson's annual sales.
Explanation / Answer
package chegg;
import java.util.Scanner;
public class SalesPerson {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter total annual sales");
double anualSales = scanner.nextDouble();
long earnedSalary = SalesPerson.calculateAnualCompasation(anualSales);
System.out.println(" Earned Salary " + earnedSalary);
double fiftyPecentageMoreSales = anualSales + ((anualSales * 50) / 100);
System.out.println("If Anual Sales is : "
+ " then salesperson could have earned : ");
for (double i = anualSales; i < fiftyPecentageMoreSales;) {
double anualSalesCouldBe = SalesPerson.calculateAnualCompasation(i);
System.out.println(" " + i + " :" + anualSalesCouldBe);
i = i + 5000;
}
if (scanner != null) {
scanner.close();
}
}
public static long calculateAnualCompasation(double anualSales) {
double minimumSalesForCompansation = ((120000 * 80) / 100);
double anualCompasation = (double) 0.0;
double standardSalary = 24000;
double accelerationFactor = (double) 1.6;
double currentCommission = (double) 4.2;
if (anualSales < minimumSalesForCompansation) {
anualCompasation = standardSalary;
} else if (anualSales >= minimumSalesForCompansation
&& anualSales <= 120000) {
double compansationAmount = (anualSales * currentCommission) / 100;
anualCompasation = (double) (24000 + compansationAmount);
} else if (anualSales > 120000) {
double compansationAmount = (anualSales * currentCommission) / 100;
double commission = currentCommission + accelerationFactor;
double extraEaring = ((anualSales - 120000) * commission) / 100;
anualCompasation = (double) (24000 + compansationAmount + extraEaring);
}
return (long) anualCompasation;
}
}
Output
-----------
Enter total annual sales
85000
Earned Salary 24000
If Anual Sales is : then salesperson could have earned :
85000.0 :24000.0
90000.0 :24000.0
95000.0 :24000.0
100000.0 :28200.0
105000.0 :28410.0
110000.0 :28620.0
115000.0 :28830.0
120000.0 :29040.0
125000.0 :29540.0
Description
---------------------
You can check the above code output that if the sales person's anual sale is $85000 the he/she earned $24000 ( standaerd salary) because that is not equal or greater than 80% of 120000 ( 96000).
Now second question was if sales will get increased upto 50% of anual sales and increament interval is 5000 then the anual earned salary was as shown in above output in table format.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.