Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have just started a sales job in a department store. Your pay consists of a

ID: 3606691 • Letter: Y

Question

You have just started a sales job in a department store. Your pay consists of a base salary and a commission. The base salary is $10,000.00. The scheme shown below is used to determine the commission rate:

Sales Amount                              Commission Rate

$0.01 - $10,000                                    7.50 percent

$10,000.01 - $20,000                        11.25 percent

$20,000.01 and above                        14.50 percent

Note that this is a graduated rate. The rate for the first $10,000 is at 7.5%, the next $10,000 is at 11.25%, and the rest is at 14.5%. If the sales amount is $25,000, the commission is 10000 * 7.5% + 10000 * 11.25% + 5000 * 14.5% = 2600.

contains a main method that calls another method that computes the commission using the commission rates described above.

The header of the called method is as follows:

public static double computeCommission(double salesAmount)

To format your table in appropriate dollars and cents, use the following import statement and format method:

      import java.text.DecimalFormat;

      DecimalFormat df = new DecimalFormat("$###,###,##0.00");

            System.out.println(df.format(364565.14));

            Output: $364,565.14

Sample Java output:

Enter table start, table end, and increment:

5000 30000 5000

Sales Amount            Commission

$5,000.00               $375.00

$10,000.00              $750.00

$15,000.00              $1,312.50

$20,000.00              $1,875.00

$25,000.00              $2,600.00

$30,000.00              $3,325.00

Enter table start, table end, and increment:

1234 12345 1000

Sales Amount            Commission

$1,234.00               $92.55

$2,234.00               $167.55

$3,234.00               $242.55

$4,234.00               $317.55

$5,234.00               $392.55

$6,234.00               $467.55

$7,234.00               $542.55

$8,234.00               $617.55

$9,234.00               $692.55

$10,234.00              $776.33

$11,234.00              $888.83

$12,234.00              $1,001.33

Explanation / Answer

import java.text.DecimalFormat;

import java.util.Scanner;

public class ComputeCommission {

  

   public static double computeCommission(double salesAmount) {

      

       double commision = 0;

      

       if(salesAmount > 20000) {

           commision = 10000*0.075 + 10000*0.1125 + (salesAmount - 20000)* 0.1450;

       }else if(salesAmount > 10000) {

           commision = 10000*0.075 + (salesAmount - 10000)* 0.1125;

       }else

           commision = salesAmount*0.075;

      

       return commision;

   }

  

   public static void main(String[] args) {

      

       Scanner sc = new Scanner(System.in);

       int start, end, inc;

       System.out.println("Enter table start, table end, and increment:");

       start = sc.nextInt();

       end = sc.nextInt();

       inc =sc.nextInt();

       sc.close();

       DecimalFormat df = new DecimalFormat("$###,###,##0.00");

       System.out.println("Sales Amount Commission");

       while(start <= end) {

           System.out.println("$"+df.format(start)+" $"+computeCommission(start));

           start = start + inc;

       }

   }

}

/*

Sampel run:

Enter table start, table end, and increment:

5000 30000 5000

Sales Amount       Commission

$$5,000.00       $375.0

$$10,000.00       $750.0

$$15,000.00       $1312.5

$$20,000.00       $1875.0

$$25,000.00       $2600.0

$$30,000.00       $3325.0

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote