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;

                Console.Write("\nEnter a license plate number: ");
                sLicence = Console.ReadLine();
                foreach (char cCh in sLicence)
                    if (char.IsDigit(cCh))
                    else if (char.IsUpper(cCh))
                    else if (char.IsLower(cCh))

                if ((iUpper > 1) && (iLower > 1) && (ilicense > 1) && (iNotValid > 1) && (sLicence.Length > 6))
                    Console.WriteLine("\n{0} is a valie license plate.", sLicence);
                    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");

Attachments 17.jpg 33.11 KB

You don't reset your counts when you enter a new plate. Move lines 5-8 to right inside the do loop.

Your if statement in line 27 needs some work, as does the else part.

Edited 5 Years Ago by Momerath: n/a

i know my code need some work, that is why i post it here, for help...

This article has been dead for over six months. Start a new discussion instead.