Reference no: EM132175751
You've been hired by City Skies to write a Java console application that manages city names. Use an array of size 30 to store the names. Present the following menu to the user:
City Skies Menu
1 - Add city
2 - Change city name
3 - Delete city
4 - List cities
9 - Exit
Enter an option:
Continue to read an option, process it, and display the menu until the user enters option 9. Here are option descriptions:
Add city - prompt for a city name. If the city is already in the list, don't add it and tell the user. If the city is not in the list, add it and tell the user. You don't need to test if the array is full before adding a city.
Change city name - prompt for a city (array) index. If the index is invalid, tell the user. If the index is valid, prompt for the new city name. If the new city name is already in the list, don't add it and tell the user. If the new city name is not in the list, add it and tell the user.
Delete city - prompt for a city (array) index. If the index is invalid, tell the user. If the index is valid, delete the city and move all the cities after the index up one to close the gap.
List cities - use printf to format the list in two columns with the first column containing an array index and the second column containing the city name. Also, show a city count after the list.
Redisplay the menu after each option is processed. Start the array with three values already in it: Houston, Charleston, and Tampa.