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 || salesOfB < 50000.00)
amount += 1000 + .065 * (salesOfB - 50000.00);
else
amount = .075 * (salesOfB - 50000.00);
Console.WriteLine("The commission is {0}",amount);
}
}
The program output should verify these test cases table:
http://wikisend.com/download/529804/image2.png
File ID: 529804
Deliverables:
This solution submission template must be used:
http://wikisend.com/download/630496/Submit
File ID: 630496
The deliverable is a Word document that includes:
1. Zip file of all of your VS project files so that it could be loaded and run in another VS
2. A copy of your source code
3. Screenshot of your output
4. Explanation of your work and how you arrived at your solution
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 || salesOfB < 50000.00)
amount += 1000 + .065 * (salesOfB - 50000.00);
else
amount = .075 * (salesOfB - 50000.00);
Console.WriteLine("The commission is {0}",amount);
}
}
The program output should verify these test cases table:
http://wikisend.com/download/529804/image2.png
File ID: 529804
Deliverables:
This solution submission template must be used:
http://wikisend.com/download/630496/Submit
File ID: 630496
The deliverable is a Word document that includes:
1. Zip file of all of your VS project files so that it could be loaded and run in another VS
2. A copy of your source code
3. Screenshot of your output
4. Explanation of your work and how you arrived at your solution