Modify the Week Two Java™ application using Java™ 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 $75,000. The current sales target for every salesperson is $140,000.
The sales incentive will only start when 80% of the sales target is met. The current commission is 25% of total sales.
If a salesperson exceeds the sales target, the commission will increase based on an acceleration factor. The acceleration factor is 1.25.
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.
Sample Table: Assuming a total annual sales of $100,000, the table would look like this:
Total Sales Total Compensation
100,000     $75,000
105,000     $75,000
110,000     $75,000
115,000     $103,750.00
120,000     $105,000.00
125,000     $106,250.00
130,000     $107,500.00
135,000     $108,750.00
140,000     $118,750.00
145,000     $120,312.50
150,000     $121,875.00
The Java™ application should also meet these technical requirements:
The application should have at least one class, in addition to the application's controlling class.
The source code must demonstrate the use of conditional and looping structures.
There should be proper documentation in the source code.

Ok that is the assignment, I have the code written and it outputs the correct initial ammounts, the problem I am having is when I input 100,000 as sales like the example given the table it ouputs only goes up to 125,000 instead of 150,000. I need help figuring out how to fix this as I have been staring at the code so long the lines are starting to dance and sing.

public class Main {

    /**
     * Program execution starts here
     * 
     * @param args
     *            the command line arguments
     */
    public static void main(String[] args) {
        // Command to format currency
        NumberFormat numberFormat = NumberFormat.getCurrencyInstance(Locale.US);
        // Command for accepting input
        Scanner input = new Scanner(System.in);

        // Command to prompt the user and accept sales amount
        System.out.print("Enter sales: ");
        double sales = input.nextDouble();

        // Assume base salary of 75000 and commission rate of 25%
        double fixedSalary = 75000;
        double commissionRate = 0.25;
        // Command to initialize sales person object with default values
        SalesPerson salesPerson = new SalesPerson(fixedSalary, commissionRate);

        // Command to calculate the total compensation and display it in
        // currency format
        System.out.println("Total compensation: " + numberFormat.format(salesPerson.calculateTotalCompensation(sales)));
        // Create table for possible total compensation
        double maxSales = 1.25 * sales;
        double salesAmount = sales;
        System.out.println("Total Sales\t\tTotal compensation");
        while (salesAmount <= maxSales) {
            System.out.println(numberFormat.format(salesAmount) + "\t\t"
                    + numberFormat.format(salesPerson.calculateTotalCompensation(salesAmount)));
            salesAmount = salesAmount + 5000;
        }
    }
}



public class SalesPerson {

    /**
     * Instance variables for storing data
     */
    private double fixedCompensation;
    private double variablePercent;

    /**
     * Default constructor
     */
    public SalesPerson() {
    }

    /**
     *
     * @param fixedCompensation
     * @param variablePercent
     */
    public SalesPerson(double fixedCompensation, double variablePercent) {
        this.fixedCompensation = fixedCompensation;
        this.variablePercent = variablePercent;
    }

    /**
     * accessors method for fixedCompensation
     *
     * @return fixedCompensation
     */
    public double getFixedCompensation() {
        return fixedCompensation;
    }

    /**
     * Mutator for fixedCompensation
     *
     * @param fixedCompensation
     */
    public void setFixedCompensation(double fixedCompensation) {
        this.fixedCompensation = fixedCompensation;
    }

    /**
     * accessors for variablePercent
     *
     * @return variablePercent
     */
    public double getVariablePercent() {
        return variablePercent;
    }

    /**
     * Mutator for variablePercent
     *
     * @param variablePercent
     */
    public void setVariablePercent(double variablePercent) {
        this.variablePercent = variablePercent;
    }

    /**
     * This method calculates and returns the total compensation.
     *
     * @param sales
     * @return totalCompensation
     */
    public double calculateTotalCompensation(double sales) {
        // Assume sales target is 140000
        double salesTarget = 140000;
        // Sales incentive kick in only if 80% of sales target has been reached
        // and upto sales target
        double salesNeededForIncentive = 0.80 * salesTarget;
        double commissionRate;
        // which means all sales above the sales target will be earning 25%
        // commission.
        double accelerationFactor = 0.50;
        if (sales > salesNeededForIncentive && sales <= salesTarget) {
            commissionRate = getVariablePercent();
        } else if (sales > salesTarget) {
            // Above the target, the commission increases to incentiveRate x
            // acceleration factor
            commissionRate = accelerationFactor;

        } else {
            // Target not met
            commissionRate = 0;

        }
        return getFixedCompensation() + (sales * commissionRate);
    }
}

Never mind, i am an idiot, the error swam out of the dancing and singing and smacked me in the face, all good now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.