Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions