only problem with this program is that when I enter 'z' to exit it works but when I try'Z' it does not work. pls help
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace assignment2_nepal
{
class sales
{
public char empname;
Double indsale;
Double indsaleA = 0;
Double indsaleB = 0;
Double indsaleE = 0;
Double indcomsaleA = 0;
Double indcomsaleB = 0;
Double indcomsaleE = 0;
const Double commrate = 0.10;
public void TotalSales()
{
Console.WriteLine("Enter A for Andrea or B or Brittany or E for Eric or z to quit:");
Console.WriteLine("Enter a salesperson initial:");
empname = Convert.ToChar(Console.ReadLine());
while (empname !== 'z' || empname=='Z')
{
if (empname == 'A' || empname == 'a')
{
Console.Out.WriteLine("Enter amount of sale");
indsale = Convert.ToDouble(Console.ReadLine());
indsaleA = indsaleA + indsale;
}
else if (empname == 'B' || empname == 'b')
{
Console.Out.WriteLine("Enter amount of sale");
indsale = Convert.ToDouble(Console.ReadLine());
indsaleB = indsaleB + indsale;
}
else if (empname == 'E' || empname == 'e')
{
Console.Out.WriteLine("Enter amount of sale");
indsale = Convert.ToDouble(Console.ReadLine());
indsaleE = indsaleE + indsale;
}
else
Console.Out.WriteLine("Invalid Entry! Please enter A, B or E for sales Employee and z to Quit");
Console.WriteLine("Enter another salesperson or z to quit");
empname = Convert.ToChar(Console.ReadLine());
}
}
public void computesales()
{
indcomsaleA = commrate * indsaleA;
indcomsaleB = commrate * indsaleB;
indcomsaleE = commrate * indsaleE;
}
public void PrintSales()
{
Console.WriteLine("Andrea earned: ${0}", indcomsaleA);
Console.WriteLine("Brittany earned: ${0}", indcomsaleB);
Console.WriteLine("Eric earned: ${0}", indcomsaleE);
}
}
class assignment2_nepal
{
static void Main(String[] args)
{
sales sale = new sales();
sale.TotalSales();
sale.computesales();
sale.PrintSales();
}
}
}