Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 completeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started