Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

' MichiganCities.vb-This program prints a msg for invalid cities in Michigan. ' Input: Interactive ' Output:

' MichiganCities.vb-This program prints a msg for invalid cities in Michigan.  

' Input: Interactive

' Output:Error msg or nothing

Option Explicit On

Option Strict On

Module Module1

 Sub Main()

   ' Declarevariables.

 Dim City As String         ' city to look up in array

    ' Initialized array of Michigan cities

Dim CityNames() As String = {"Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glenn", "Midland", "Brooklyn"}

Dim FoundIt As Boolean = False   ' Flag variable

    Dim X As Integer      ' Loop control variable

    ' Get user input

    City = InputBox$("Enter city name: ")

    ' Add your loop here

      ' Add your test statement here to see if there is 

      ' a match. Set the flag to true if city is found. 

    ' Test to see if city was not found to determine if 

    ' "Not a city in Michigan" msg should be printed

  End Sub ' End of Main() procedure

End Module ' End of MichiganCities module

VisualBasic:Modify with a for loop statement examining city names. Need a code testing for match. Need a code that when appropriate print message: "Not a city in Michigan." Execute the program with these as input: Chicago; Brooklyn; Watervliet; Acme. Output how many cities are searched. Dont hardcore to 10 in program. Use the length property of array. Show city name in output like City Detroit found and Canton is not a city in Michigan. Show message if city is found/not found.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question