Question: Write a program for Java commission rates 1. The goal for the commission(The amount of the money that you can make) 2. Base rate for
Write a program for Java commission rates
1. The goal for the commission(The amount of the money that you can make)
2. Base rate for the commission. The sales commission starts at this rate
This is an example of how the commission could change, in this table the commission rate goes up by 2 percent when the sales amount goes up by 5000. Note that the commission rate cannot be higher than a certain amount which is going to be stored in a constant. You can set the constant to 30 percent.
| Sales amount | commission |
| 0.01-5000 | 8 percent (base rate) |
| 5000.01 - 10000 | 10 percent |
| 10000.01 - 15000 | 12 percent |
| 15000.01 - 20000 | 14 percent |
3. The amount of the sale needs to increase the commission rate. Table below shows that the commission rate goes up by 2 percent with the interval of 5000 sale amount.
Sample output completion
Enter a positive amount for commission goal that you want to get: 10000
Enter a positive amount base rate for commission: 8
Enter a positive amount of percent increase for commission: 2
Enter a positive amount for the sale interval that commission increases: 5000
To get the 10000.00 of commission, you need to have 84375.01 of sale
Do you want to use the app again (yes/no)? yes
Enter a positive amount for commission goal that you want to get: 10000
Enter a positive amount base rate for commission: 10
Enter a positive amount of percent increase for commission: 1
Enter a positive amount for the sale interval that commission increases: 500
To get the 10000.00 of commission, you need to have 96250.01 of sale
Do you want to use the app again (yes/no)? no
------------------------------------
import java.util.Scanner;
public class comissionShell {
/** Main method */
public static final double MAX_RATE = 25;
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
run(kb);
}
public static void run(Scanner kb)
{
boolean repeat = true;
while(repeat)
{
//call the method saleAmount
// ask the user if he/she wants to use the app again
//update the loop control variable based on the user's input
}
}
public static void saleAmount(Scanner kb)
{
double salesAmount = 0;// .01;
// call the method getValidDouble to get the sale goal amount
//call the method getValidDouble to get the base rate
//call the method getValidDouble to get the percent that the
commisiio increases
//call the method getValidDouble to getthe sale interval that the
commission increases
double commission = 0;
// while (commission is less than the goal)
{
//call the method comission
//if the commission is less thatn the goal
//increase the saleamount by 0.1
}
//output the result
}
public static double comission(double saleAmount, double baseRate,
double increment, double interval)
{
double total = 0;
double com = 0;
double count = 0;
double sale = saleAmount;
//while(sale is gretaer than interval)
{
// subtract minSale from sale and store the result in sale
//add the increment to count
}
//find the maximimu rate by adding the count to baseRate and storing
it in a new variable called rate
//while rate is gretaer than zero and saleAmount is gretaer than
interval
{
//set com to interval * rate/100
// reduce the saleAmount by interval
//reduce the rate by the increment
//add com to total
}
// if (saleAmount > 0)
//calculate the leftover
return total;
}
//use the code form the class to help you with the data type validation
and the range validation
public static double getValidDouble(Scanner kb, String prompt)
{
return 0;
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
