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

wirte a C# program usig if-else stament A company pays its salespersons on a com

ID: 3901863 • Letter: W

Question

wirte a C# program usig if-else stament

A company pays its salespersons on a commission basis. The commission is calculated on a scale as
follows:
SALES AMOUNT PAYMENT TO SALESPERSON
$0 to $5,000.00 $200 plus 9% of sales amount
$5,000.01 to $25,000.00 $500 plus 15% of sales amount
$25,000.01 to $50,000.00 $1,000 plus 20% of sales amount
Greater than $50,000.00 50 percent of sales amount
Write a C# Console program that inputs four salesperson names and their corresponding sales amounts.
For each salesperson, compute the amount to be paid to the salesperson.
You should not use a loop. Just input a name, a sales amount, and calculate and display the payment
then another input of name, input of sales amount, and calculation and display of payment, and so on.
Use an if … else … statement to determine the payment scale to use. Here is an example interaction
session:
Enter sales person name: Rita Williams
Enter amount sold by Rita Williams: 5000
Rita Williams payment is $650.00
.
.

Explanation / Answer

using System;

public class Test
{
public static void Main()
{
double payment=0;

Console.WriteLine("Enter sales person name: ");
string name = Console.ReadLine();
Console.WriteLine("Enter amount sold by Rita Williams: ");
double sales = Convert.ToDouble(Console.ReadLine());

if(sales >=0 && sales <= 5000.00)
payment = 200 + 0.09*sales;
else if(sales >=5000.01 && sales <= 25000.00)
payment = 500 + 0.15*sales;
else if(sales >=25000.01 && sales <= 50000.00)
payment = 1000 + 0.20*sales;
else if(sales >=50000.00)
payment = 0.5*sales;

Console.WriteLine(name+" payment is ${0:0.00}",payment);


}
}

Output:

Enter sales person name:Rita Williams
Enter amount sold by Rita Williams:5000
Rita Williams payment is $650.00

Do ask if any doubt. Please upvote.