Question: Repeat the following until currCity's readNameAndPopulation ( ) method returns false: Assign currCity with a new City object. Use currCity's readNameAndPopulation ( ) method to

Repeat the following until currCity's readNameAndPopulation() method returns false:
Assign currCity with a new City object.
Use currCity's readNameAndPopulation() method to read each pair of inputs, string name and integer population.
If currCity's readNameAndPopulation() method returns true, append currCity to ArrayList cityList.
Ex: If the input is Bow 1400 Adomstown 4900 Jackson 1700 Sundance 2600 end, then the output is:
City: Bow, Population: 1400 City: Adomstown, Population: 4900 City: Jackson, Population: 1700 City: Sundance, Population: 2600

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 Programming Questions!