The methods are to be changed to value-receiving


Purpose: To be more usable and flexible.

Instructions: Name the program to CityYourLastNameFirstInitialLE52.java. The methods are to be changed to value-receiving, value-returning and/or a combination thereof. Therefore, when you call these methods make sure you send the correct arguments and properly process the value that is returned. Refer to the sample output for details about the prompts and final output.

The Scanner variable is the only global variable.

The other global variables will be localized to the main(), except you will delete the global variable that stores the city to state population percentage.

cityName(): Returns the name of the city.

stateName(): Returns the name or the abbreviation for the state.

cityPopulation(): Receives the name of the city and returns the population for it.

statePopulation(): Receives the name or abbreviation for the state and returns the population for it.

cityPercState(): Receives the populations for the city and the state and returns the city to state population percentage.

displayCityStateStats(): Receives the name of the city, the name or abbreviation for the state, the population for the city, the population for the state, and the city to state population percentage.

main():

Calls cityName() and stores the returned value in a local variable.

Calls stateName() and stores the returned value in a local variable.

Calls cityPopulation() by sending it the city name and stores the returned value in a local variable.

Calls statePopulation() by sending it the state name or abbreviation and stores the returned value in a local variable.

Calls displayCityStateStats() by sending it the 4 local variables mentioned above as arguments and calling cityPercState() as its 5th argument.

Exit the main().

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: The methods are to be changed to value-receiving
Reference No:- TGS01051125

Expected delivery within 24 Hours