Make sure you have downloaded the books source code from the companion Web site at www.pearsonhighered.com/gaddis. In
Question:
Make sure you have downloaded the book’s source code from the companion Web site at www.pearsonhighered.com/gaddis. In this chapter’s source code folder you will find a program named CreateCityDB.java. Compile and run the program. The program will create a Java DB database named CityDB. The CityDB database will have a table named City, with the following columns:
The CityName column stores the name of a city and the Population column stores the population of that city. After you run the CreateCityDB.java program, the City table will contain 20 rows with various cities and their populations.
Next, write a program that connects to the CityDB database, and allows the user to select any of the following operations:
• Sort the list of cities by population, in ascending order.
• Sort the list of cities by population, in descending order.
• Sort the list of cities by name.
• Get the total population of all the cities.
• Get the average population of all the cities.
• Get the highest population.
• Get the lowest population.
Step by Step Answer:
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis