herbie

herbie

  • NA
  • 14
  • 0

New to C#

Apr 2 2007 1:31 PM
I have a program that I am writing, that I need to assign a variable to three sales people so I can keep a runnign tab of their commision.  Any thoughts would be appericated.

using System;

public class LoopingCommision

{

public static void Main()

{

string SalesPeople, Sales;

char response;

Console.WriteLine("Do you want to caculate commision of a sales person? Y or N");

response = GetChar();

while (response == 'Y')

{

Console.WriteLine("Enter Sales persons inital? A, B or E ");

SalesPeople = Console.In.ReadLine();

if (SalesPeople =="A") Console.Out.WriteLine("Enter the ammout of sales for this sales person");

else if (SalesPeople =="B")Console.Out.WriteLine("Enter the ammout of sales for this sales person");

else if (SalesPeople =="E")Console.Out.WriteLine("Enter the ammout of sales for this sales person");

Sales = Console.In.ReadLine();

double Commision = Convert.ToDouble(Sales) / 10.0;

Console.WriteLine("The commision is {0}",Commision);

Console.Out.WriteLine("Do you want to enter more commisions? Y or N");

response = GetChar();

}

Console.WriteLine("Have a nece day!");

}

public static char GetChar()

{

string inputString;

char answer;

inputString = Console.In.ReadLine();

answer = Convert.ToChar(inputString);

return answer;

}

}


Answers (1)