Joseph

Joseph

  • NA
  • 14
  • 17.3k

foreach loop

Mar 27 2011 8:25 PM

The license plate must meet the following specifications:

·         It must contain three digits.

·         It must contain three uppercase letters.

The foreach loop will be used to examine each character in the license plate that was entered by the user as a string. If an invalid character is found in the string, display the character with an error message. If an incorrect number of characters or digits are found in the plate, display an error message for each error. If a lowercase letter is encountered, display an error message.

If the license plate contains no errors, display the plate and a string indicating that it is valid.

this what supposed to look like...



this all i got, i dont know what to do next...could someone help me.

            Console.WriteLine("{0, 40}", "ICA17 - License Plate Checker");

            string sLicence;
            string sAgain;

            do
            {
                Console.Write("\nEnter a license plate number: ");
                sLicence = Console.ReadLine();

                foreach (char cCh in sLicence)
                {
                    Console.Write("{0}", cCh);
                }

                Console.Write("\nRun again? \"yes\" to enter another plate: ");
                sAgain = Console.ReadLine();
            }
            while(sAgain == "yes");

            Console.ReadLine();



Answers (1)