*****PLEASE NOTE!!***** I have only been taught how to use import java.io.*; and no other java imports to do this progra

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

*****PLEASE NOTE!!***** I have only been taught how to use import java.io.*; and no other java imports to do this progra

Post by answerhappygod »

*****PLEASE NOTE!!***** I have only been taught how to
use import java.io.*; and no other java imports to do
this program. Thank you in advance.
*****************************************
DO NOT USE ARRAYLIST
DO NOT USE ENHANCED FOR EACH LOOP
DO NOT WRITE OOP
Download a data file (City_Precipitation_Data.txt). The data
file contains the precipitation data for a number of selected US
cities.
Write a program that uses two arrays, one to store the city
names, and another to store the precipitations. The program also
uses 4 methods to process the arrays.
- The 1 st method has two parameters (name array and
precipitation array), it prints each city’s name and
precipitation
- The 2 nd method has one parameter (precipitation array), it
finds and returns the index of the most precipitation.
- The 3rd method has one parameter (precipitation array), it
finds and returns the index of the least precipitation.
- The 4th method has one parameter (precipitation array), it
calculates and returns the average precipitation of all the
cities.
In the main method, create two arrays and read data from the
data file into the arrays, and call the methods as follows:
- Call the 1 st method to print each city’s name and
precipitation
- Call the 2 nd method to get the index of the highest
precipitation, then print the city name with the highest
precipitation (assume there is no tie).
- Call the 3 rd method to get the index of the least
precipitation, then print the city name with the least
precipitation (assume there is no tie).
- Call the 4 th method to get the average precipitation and
print it. - Then the program prints all the cities that have less
than the average precipitation and all the cities that have more
than or equal to the average precipitation.
Please Note I Have Only Been Taught How To Use Import Java Io And No Other Java Imports To Do This Progra 1
Please Note I Have Only Been Taught How To Use Import Java Io And No Other Java Imports To Do This Progra 1 (86.59 KiB) Viewed 41 times
Please Note I Have Only Been Taught How To Use Import Java Io And No Other Java Imports To Do This Progra 2
Please Note I Have Only Been Taught How To Use Import Java Io And No Other Java Imports To Do This Progra 2 (92.18 KiB) Viewed 41 times
Please Note I Have Only Been Taught How To Use Import Java Io And No Other Java Imports To Do This Progra 3
Please Note I Have Only Been Taught How To Use Import Java Io And No Other Java Imports To Do This Progra 3 (33.6 KiB) Viewed 41 times
Sample run: Name Precipitation in Inches Billings Honolulu Houston Indianapolis Jackson Jacksonville Juneau Kansas City Richmond Knoxville Birmingham Bismarck Bridgeport Burlington Albuquerque Anchorage Asheville Charleston Charleston Charlotte Atlantic City Portland Portland New Orleans New York Oklahoma City Sioux Falls Baltimore Baton Rouge Columbia Cheyenne Cleveland Columbus Dallas-Ft_Worth Des_Moines Fairbanks Grand_Junction Grand Rapids Hartford Las Vegas Lexington Little Rock Washington Long Beach Los_Angeles Louisville Milwaukee Minneapolis Montgomery Mt. _Washington Nashville Springfield St Louis Philadelphia Providence Sacramento Salt Lake City San Antonio San Diego San Francisco 14.77 18.29 47.84 40.95 55.95 52.34 58.33 37.98 43.91 48.22 53.99 16.84 44.15 36.05 9.47 16.08 47.07 51.53 44.05 43.51 40.59 45.83 37.07 64.16 49.69 35.85 24.69 41.94 63.08 48.27 15.45 38.71 38.52 34.73 34.72 10.34 8.99 37.13 46.16 4.49 45.91 50.93 39.35 12.94 13.15 44.54 34.81 29.41 54.77 101.91 48.11 35.56 38.75 42.05 46.45 17.93 16.50 32.92 10.77 20.11
Savannten Seattle-Tacoma 37.07 Pittsburgh 37.85 Vero Beach 51.93 Wilmington 42.81 Dodge_City 22.35 [66 cities] The city with the most precipitation is Mt. _Washington: 101.91. The city with the least precipitation is Las Vegas: 4.49. The average precipitation of all cities is 37.35. The cities that have less than the average precipitation: Billings 14.77 Honolulu 18.29 Bismarck 16.84 Burlington 36.05 Albuquerque 9.47 Anchorage 16.08 Portland 37.07 Oklahoma City 35.85 Sioux Falls 24.69 Cheyenne 15.45 Dallas-Ft Worth 34.73 Des Moines 34.72 Fairbanks 10.34 Grand_Junction 8.99 Grand Rapids 37.13 Las Vegas 4.49 Long Beach 12.94 Los_Angeles 13.15 Milwaukee 34.81 Minneapolis 29.41 Springfield 35.56 Sacramento 17.93 Salt Lake_City 16.50 San Antonio 32.92 San Diego 10.77 San Francisco 20.11 Seattle-Tacoma 37.07 Dodge_City 22.35 [28 cities] The cities that have more than or equal to the average precipitation: Houston Indianapolis Jackson Jacksonville Juneau Kansas City Richmond Knoxville Birmingham Bridgeport Asheville Charleston Charleston Charlotte Atlantic City Portland 47.84 40.95 55.95 52.34 58.33 37.98 43.91 48.22 53.99 44.15 47.07 51.53 44.05 43.51 40.59 45.83
New Orleans New_York Baltimore Baton Rouge Columbia Cleveland Columbus Hartford Lexington Little_Rock Washington Louisville 64.16 49.69 41.94 63.08 48.27 38.71 38.52 46.16 45.91 50.93 39.35 44.54 Montgomery Mt. _Washington Nashville St Louis Philadelphia Providence Savannah Pittsburgh Vero Beach Wilmington (38 cities] 54.77 101.91 48.11 38.75 42.05 46.45 49.58 37.85 51.93 42.81
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply