Question: // MichiganCities.java . This progran prints a essage for trvaltd cttles Ln Michtgan. 2 II Input: Interactive. 3 /I Output: Error nessage or nothing Summary
// MichiganCities.java . This progran prints a "essage for trvaltd cttles Ln Michtgan. 2 II Input: Interactive. 3 /I Output: Error nessage or nothing Summary In this lab, you use what you have learned about searching an array to find an exact match to complete a partially prewritten Java program. The programl uses an array that contains valid names for 10 cities in Michigan. You ask the user of the program to enter a city name; your program then searches the array for that city name. If it is not found, the program should print a message that informs the user name is not found in the list of vet- cities in Michigan. The data file provie for this lab includes the input statements and the necessary variab declarations. You need to use a loop to examine all the items in the array and test for a match. You also need to set a 6 inport java.util. Scanner. 8 public class MichtganCittes 18 publtc stattc votd natn(String argst1) throws Exception // Declare variables String inCity II nane of city to look up tn //Intttalized array of cities in Mtchigan. String cttiesInMtchtgang1 -(Aone". TAlbton", "Detrott' Watervlteth Coloma" Sagtna". Ruchland", "Glenn". Hidland" bootean foundIt- f: / Fleg vortable / Loop control vartable DELL
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
