A company pays its employees on a commission basis Each empl

A company pays its employees on a commission basis. Each employee receives 9% of his gross sales for that week. Create a C# application to do the following.

     (1) Suppose this company has 6 employees. Ask the user to enter the gross sales of each employee. Store the input values in an array.

     (2) Calculate the commission earned by each employee. Create another array to store the commissions.

     (3) Display the gross sales and the earned commission of each employee.

     (4) Use a foreach statement to calculate the sum of the commissions earned by these 6 employees. Display the sum.

Solution

Program:

using System.IO;
using System;

class Employee
{
static void Main()
{
double sum=0;
Console.WriteLine(\"Welcome !!!!\");

double[] grossSales=new double[6];
double[] commisions=new double[6];
  

for(int i=0;i<6;i++)
{
Console.WriteLine(\"Enter Gross Sales of employee:{0}\",(i+1));
grossSales[i]=double.Parse(Console.ReadLine());
commisions[i]=(9*grossSales[i])/100;
}

Console.WriteLine();
Console.WriteLine(\"------Output------\");
for(int i=0;i<6;i++)
{
Console.WriteLine(\"Gross salary of employee:{0} is {1} and commision:{2}\",(i+1),grossSales[i],commisions[i]);
}

  
foreach (double i in commisions)
{
sum+=i;   
}
Console.WriteLine(\"Sum of commisions:{0}\",sum);
Console.ReadLine();
}
}

A company pays its employees on a commission basis. Each employee receives 9% of his gross sales for that week. Create a C# application to do the following. (1)

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site