Question: A 2D array has population statistics for 100 Canadian cities for the last 50 years. Each row contains the data for one city, arranged alphabetically

A 2D array has population statistics for 100 Canadian cities for the last 50 years. Each row contains the data for one city, arranged alphabetically starting with Abbotsford, BC. Each column has the data for one year, starting with 1970.

Additionally there is a one dimensional array called cityNames with the names arranged alphabetically to match the rows of the 2D array.

Write a Java code segment (just the code that answers the question, not an entire program) for each of the questions below:

a) find the total population for all 100 cities for 1970 (2 marks)

b) find the city with the highest one year population over the 50 years. Write out the city name, the population, and the year the highest occurred. (it might not be the last year, since populations can go up and down) (3 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!