Question: Write a program that asks the user to enter a number of cities and store them in an array called cities. Then ask the user
Write a program that asks the user to enter a number of cities and store them in an array called cities. Then ask the user to enter a letter. Print all the cities that begin with that letter first, and then print all the cities that have the letter in their name (note you need to deal with case upper and lower case). Test this with two outputs where you have changed the array elements and create arrays of different lengths.

Sample output (5 cities and letter T):v -JGRASP exec: java Lab7 Cities Enter the number of cities to enter: 5 Enter cityl: Toronto Enter city2: Belleville Enter city3: Halifax Enter eity4: Ottava Enter city5: Detroit Enter a letter T Cities that start with T Toronto All cities that contain T: Toronto ottawa Detroit -JGRASP: operation complete
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
