0

Java program to print max and temperature of 5 cities for 7 days

26th Feb 2017, 9:12 AM
David Rk
David Rk - avatar
4 Respostas
+ 5
Need more information. Where do you want to get the weather data from?
26th Feb 2017, 10:15 AM
Tashi N
Tashi N - avatar
+ 3
Then you only have to store the cities name and the corresponding temperatures in a collection, e.g. Map<String, ArrayList<String>> hashMap = new HashMap<String, ArrayList>(); The String will be the cities name and the corresponding ArrayList the temperatures. Then loop through the HashMap and nest another loop, where you iterate through the corresponding ArrayList. Then create another HashMap where you store only the key/value pair with the highest temperature (test by if condition and remember the highest temperature in a temp int to access the correct key/value pair after the inner loop). If you need further help, please post your code or publish it at the playground so we can help you to find a solution.
26th Feb 2017, 3:18 PM
Tashi N
Tashi N - avatar
0
its random
26th Feb 2017, 2:22 PM
David Rk
David Rk - avatar
0
can u please help me with the whole program. thanks so far
27th Feb 2017, 6:06 AM
David Rk
David Rk - avatar