Array Of Objects Program
Description
This program uses an array of City objects to store city information (name and population) and uses several methods to do the following:
Fill in the array with the user input data
Print cities' name and population stored in the array
Search the array to find the the city with the most population (assume there is no tie) and print the result
Print cities' name and population stored in the array
Search the array to find the the city with the most population (assume there is no tie) and print the result
Associated Concepts:
Array
OOP
OOP
Algorithm:
For City class, the class diagram is represented in
UML (Unified Modeling Language) notation.
Client program:
Client program:
Create an array of City class to store 5 cities' data
Call methods to:
Call methods to:
Populate the arrays based on the user input data
Print array elements
Find the index of the city with the most population and print the result
Print array elements
Find the index of the city with the most population and print the result