Hello I am need of some assistance. I have an assignment I am working on that is supposed to do the following. • The company has recently changed its total annual compensation policy to improve sales.
• A salesperson will continue to earn a fixed salary of $50,000. The current sales target for every salesperson is $80,000.
• The sales incentive will only start when 80% of the sales target is met. The current commission is 12% of total sales.
• If a salesperson exceeds the sales target, the commission will increase based on an acceleration factor. The acceleration factor is 1.3.
• 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.
Here is my code thus far.
the problem is when I run the program my input methods work as they should but the results are not correct.Here is the results I get after I runpublic static void main(String[] args) { String input; //Input of user double salary; //This is the annual sales value double commissionrate; //This is the commission rate double commission; //This is the amount of commision made double pay; //Salesperson's pay double sales; //annual sales double incentive = 0; //sales incentive DecimalFormat dollar = new DecimalFormat(""); DecimalFormat percent = new DecimalFormat(""); input = JOptionPane.showInputDialog("Enter the annual salary."); salary = Double.parseDouble(input); input = JOptionPane.showInputDialog("Enter current commission rate."); commissionrate = Double.parseDouble (input); input = JOptionPane.showInputDialog("Enter the current sales target."); sales = Double.parseDouble (input); commission = commissionrate * salary; pay = commission + salary; JOptionPane.showMessageDialog(null, "Commission rate is " + commissionrate + ". The amount of pay is " + dollar.format(pay)); if (sales>= (.80* sales) && sales<= 150000) incentive = (.80* sales); else if (sales >150000) incentive = (1.3 * .75 * sales); JOptionPane.showMessageDialog (null, "Total Sales" + "Total Compensation" + dollar.format(sales) + (dollar.format(sales) + dollar.format(incentive) ) ); System.exit(0); } }
commission rate 12,the amount of pay is 650,000
The total annual compensation is 120,000,120,00096000
The amount of pay in incorrect as well as the Total annual compensation. Not for sure why the calculations is happening the way it is. Help me understand and what I need to change to make it function properly.