Question: Write the inputCities ( ) method in the SmallTowns class. Within inputCities ( ) , use scnr to read pairs of inputs, integer currPopulation and

Write the inputCities() method in the SmallTowns class. Within inputCities(), use scnr to read pairs of inputs, integer currPopulation and string currName, until -99 is read from input. Create each City object with currPopulation and currName as arguments and append each object to ArrayList cityList.
Ex: If the input is 3600 Opal 2600 Yonder 2200 Goshen 4500 Worland -99, then the output is:
City population: 3600, Name: Opal City population: 2600, Name: Yonder City population: 2200, Name: Goshen City population: 4500, Name: Worland

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!