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

Salesperson Commission The following program attempts to calculate the total com

ID: 3538344 • Letter: S

Question

Salesperson Commission

The following program attempts to calculate the total commission received by a salesperson who earns 7% on sales of product A which total less than $40,000 and 10% on the amount of sales above $40,000. For example, a sale of $50,000 would earn a commission of $3800. The salesperson receives a commission of 5% on sales of product B under $20,000, 6.5% on the amount of sales over $20,000 but under $50,000, and 7.5% on the amount over $50,000. Find and correct any errors in this program:

public class Commission {

    public static void main(String [] args) {

     Console.Write("Enter the amount of Product A sales: ");

      double salesOfA = double.Parse(Console.ReadLine());

     Console.Write("Enter the amount of Product B sales: ");

      double salesOfB = double.Parse(Console.ReadLine());

      double amount = 0;

      if (salesOfA < 40000.00)

        amount += .07 * salesOfA;

      else

        amount = .1 * (salesOfA - 40000.0);

      if (salesOfB < 20000.00)

        amount += .05 * salesOfB;

      else if (salesOfB > 20000.00 || salesOfB < 50000.00)

        amount += 1000 + .065 * (salesOfB - 50000.00);

      else

        amount = .075 * (salesOfB - 50000.00);

     Console.WriteLine("The commission is {0}",amount);

   }

}

Your program output should look like this sample output:

salesOfA = 50000

salesOfB = 40000

commission is 6100

Explanation / Answer

100% executable code





using System.IO;

using System;

public class Commission {

public static void Main() {

Console.Write("Enter the amount of Product A sales: ");

string value1 = Console.ReadLine();

double salesOfA = Double.Parse(value1);

Console.Write("Enter the amount of Product B sales: ");

string value2 = Console.ReadLine();

double salesOfB = Double.Parse(value2);

double amount = 0;

if (salesOfA < 40000.00)

amount += .07 * salesOfA;

else

amount += .1 * (salesOfA - 40000.0)+ (.07 * 40000);

if (salesOfB < 20000.00)

amount += .05 * salesOfB;

else if (salesOfB > 20000.00 && salesOfB < 50000.00)

amount += 1000 + .065 * (salesOfB - 20000.00);

else

amount += 1000 + 1950 +.075 * (salesOfB - 50000.00);

Console.WriteLine("The commission is {0}",amount);

}

}





Dont forget to rate for the 100% complete and correct answer




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