There is something wrong with my code...
even i put a valid license the display showing
is the line 30-33 supposed to be line 28.
how to display the not character in line 30 instead of counting how many.
Console.WriteLine("{0, 40}", "ICA17 - License Plate Checker");
string sLicence;
string sAgain;
int ilicense = 0;
int iUpper = 0;
int iLower = 0;
int iNotValid = 0;
do
{
Console.Write("\nEnter a license plate number: ");
sLicence = Console.ReadLine();
foreach (char cCh in sLicence)
{
if (char.IsDigit(cCh))
++ilicense;
else if (char.IsUpper(cCh))
++iUpper;
else if (char.IsLower(cCh))
++iLower;
else
iNotValid++;
}
if ((iUpper > 1) && (iLower > 1) && (ilicense > 1) && (iNotValid > 1) && (sLicence.Length > 6))
Console.WriteLine("\n{0} is a valie license plate.", sLicence);
else
Console.WriteLine("The {0} character is not valid.", iNotValid);
Console.WriteLine("There was an incorrect number of digits.");
Console.WriteLine("There was an incorrect number of letters.");
Console.WriteLine("There is a lowercase letter in the plate.");
Console.Write("\nRun again? \"yes\" to enter another plate: ");
sAgain = Console.ReadLine();
}
while(sAgain == "yes");
Console.ReadLine();