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.
Sample Table: Assuming a salesperson's annual sales of $100,000, the table would look like this:
Total Sales
|
Total Compensation
|
100,000
|
<>
|
105,000
|
<>
|
110,000
|
<>
|
115,000
|
<>
|
120,000
|
<>
|
125,000
|
<>
|
130,000
|
<>
|
135,000
|
<>
|
140,000
|
<>
|
145,000
|
<>
|
150,000
|
<>
|
- The application will now compare the total annual compensation of at least two salespersons.
- It will calculate the additional amount of sales that each salesperson must achieve to match or exceed the higher of the two earners.
- The application should ask for the name of each salesperson being compared.
The JavaTM application should also meet these technical requirements:
· The application should have at least one class, in addition to the application's controlling class
Here is what I have so far - but am lost on how to compare at least two salespeople.
/*************************************************************
* Roy Gibson
* annual compensation of a salesperson
* PRG/420 Computer Programming I
*
*
***************************************************************/
public class Compensation
{
private double annualSalary;
private double annualSales;
private double commissionPercent;
private double accelerationFactor;
// Constructor
Compensation()
{
annualSalary = 0;
annualSales = 0;
commissionPercent = 0;
accelerationFactor = 0;
}
Compensation(double aSalary, double aSales, double aCommPercent, double aAccelerationFactor)
{
annualSalary = aSalary;
annualSales = aSales;
commissionPercent = aCommPercent;
accelerationFactor = aAccelerationFactor;
}
// Public Methods
public void setAnnualSalary(double aSalary)
{
annualSalary = aSalary;
}
public void setAnnualSales(double aSales)
{
annualSales = aSales;
}
public void setCommissionPercent(double aCommPercent)
{
commissionPercent = aCommPercent;
}
public void setAccelerationFactor(double aAccFactor)
{
accelerationFactor = aAccFactor;
}
public double getAnnualSales()
{
return annualSales;
/*************************************************************
*Roy Gibson
*
* PRG/420 Computer Programming I
*
*
***************************************************************/
import java.text.*;
import java.io.*;
import java.util.*;
class PRG420Week3
{
/*************************************************************
* Main () function.
*
*
**************************************************************/
public static void main(String[] args)
{
//Create a new instance of the main class object
Compensation obj = new Compensation ();
/*************************************************************
* call the functions passing it the needed constants.
*
**************************************************************/
obj.setAnnualSalary (50000);
obj.setCommissionPercent (0.12);
obj.setAccelerationFactor(1.3);
int sales;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter the total sales in integer value: $");
sales = keyboard.nextInt();
obj.setAnnualSales((double)sales);
/*************************************************************
* call the functions to calculate compensation, based on input
* earlier.
**************************************************************/
double total = obj.calculateCompensation ();
System.out.println("The total compensation is: $" + total + "\n");
/*************************************************************
* call the functions to calculate compensation table
*
**************************************************************/
NumberFormat theNumberFormat = NumberFormat.getCurrencyInstance();
// Output table header. Use tab escape \t to create even spacing.
System.out.println("Total Sales\t\tTotal Compensation");
System.out.println("-----------\t\t------------------");
int step = 5000;
// Create stopping point for while loop that is 50% higher than annual sales.
double anchor = obj.getAnnualSales() * 1.5;
do
{
obj.setAnnualSales(obj.getAnnualSales() + step);
System.out.println(theNumberFormat.format(obj.getAnnualSales()) + "\t\t" + theNumberFormat.format(obj.calculateCompensation()));
} while (obj.getAnnualSales() < anchor);
}
}