Answered You can hire a professional tutor to get the answer.
Do not use ArrayList, do not use global variables, do not use enhanced for loop (for each loop), do not write OOP.
Do not use ArrayList, do not use global variables, do not write OOP.
1. Write java program that allows the user to enter 10 city names followed by their average annual rainfalls. Use an array of String to store the city names and an array of double to store their rainfalls. Write several user-defined methods as follows:
- Write method that prompts the user to enter 10 city names and their average annual rainfalls to populate two arrays
- Write method that prints each city's name and the rainfall in the arrays.
- Write method that returns the index of the highest rainfall.
- Write method that returns the average rainfall of 10 cities.
In the main method, create two arrays and then call the methods to get the results.
The program should print the following information:
- Each city's name and rainfall
- The highest rainfall
- The city with the highest rainfall
- The average rainfall of 10 cities
- The names of the cities that have less than the average rainfall
- The names of the cities that have greater than or equal to the average rainfall
Sample run:
Enter city's name (#1):
Enter city's rainfall (#1):
Enter city's name (#2):
Enter city's rainfall (#2):
Enter city's name (#3):
Enter city's rainfall (#3):
Enter city's name (#4):
Enter city's rainfall (#4):
Enter city's name (#5):
Enter city's rainfall (#5):
Enter city's name (#6):
Enter city's rainfall (#6):
Enter city's name (#7):
Enter city's rainfall (#7):
Enter city's name (#8):
Enter city's rainfall (#8):
Enter city's name (#9):
Enter city's rainfall (#9):
Enter city's name (#10):
Enter city's rainfall (#10):
City Name Rainfall
*********************
Fargo 21.19
Indianapolis 40.95
Knoxville 47.83
Boise 12.19
Boston 42.52
Buffalo 40.54
Albany 38.60
Duluth 31.00
Fargo 21.19
Houston 47.84
Denver 15.81
Highest rainfall: 47.84
City with the highest rainfall: Houston
Average Rainfall of 10 Cities: 29.06
Cities with rainfalls less than average:
Fargo Boise Denver
Cities with rainfalls equal to or greater than average:
Indianapolis Knoxville Boston Buffalo Albany Duluth Houston