Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: http://solutionzip.com/downloads/population/
- Write a program that uses the ArrayList class to store objects. Do NOT use static
- arrays that we used in earlier chapters. Listing 11.8 on page 433 may be helpful. Write a
- program to store the name of a city and its population using 2 ArrayLists (one to hold
- the name and the other to hold the population). A sample input might look like:
- London 8000000
- Boston 600000
- Las Vegas 580000
- Once you have the data in the arrays, display the size of the arrays, ask the user to
- enter a city name and check if the name exists in the array. Allow the user to add more
- cities and to be able to remove cities. Display the contents of the arrays using its
- toString method. Allow the user to enter a city name and display the corresponding
- population. If the input city name does not exist, display a message. Calculate and
- display the total population of all the cities. Sort the data by population in ascending
- order and display the data in the original order and the sorted order. You may use any
- sorting algorithm that you like.
- Download: http://solutionzip.com/downloads/population/
Add Comment
Please, Sign In to add comment