A large company pays its salespeople on a commission basis. The salespeople rece
ID: 2246444 • Letter: A
Question
A large company pays its salespeople on a commission basis. The salespeople receive $200 per week, plus 9% of their gross sales for that week. For example, a salesperson who sells $5000 worth of merchandise in a week receives $200 plus 9% of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Develop a C# program, that inputs one salesperson's items sold for last week and calculates and displays that salesperson's earnings. There is no limit to the number of items that can be sold by a salesperson.Explanation / Answer
//Please see the code below please do thumbs up if you like the solution
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace csharp_prj
{
class Program
{
private const decimal Item1 = 239.99M;
private const decimal Item2 = 129.75M;
private const decimal Item3 = 99.95M;
private const decimal Item4 = 350.89M;
private const decimal payPerWeek = 200M;
private const decimal percentage = 0.09M;
public static decimal calCommission(int itemSold1, int itemSold2, int itemSold3, int itemSold4)
{
decimal gross = (Item1 * itemSold1) + (Item2 * itemSold2) + (Item3 * itemSold3) + (Item4 * itemSold4);
decimal total = payPerWeek + percentage * gross;
return total;
}
static void Main(string[] args)
{
int noOfItem1Sold = 0;
int noOfItem2Sold = 0;
int noOfItem3Sold = 0;
int noOfItem4Sold = 0;
Console.WriteLine("Enter the number of Item1 sold");
noOfItem1Sold = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the number of Item2 sold");
noOfItem2Sold = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the number of Item3 sold");
noOfItem3Sold = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the number of Item4 sold");
noOfItem4Sold = Convert.ToInt32(Console.ReadLine());
decimal totalEarning = calCommission(noOfItem1Sold, noOfItem2Sold, noOfItem3Sold, noOfItem4Sold);
Console.WriteLine("Total Earning of sale person is " + totalEarning);
}
}
}
OutPut:
Enter the number of Item1 sold
10
Enter the number of Item2 sold
10
Enter the number of Item3 sold
10
Enter the number of Item4 sold
10
Total Earning of sale person is 938.5220
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.