0
Java program to print max and temperature of 5 cities for 7 days
4 odpowiedzi
+ 5
Need more information. Where do you want to get the weather data from?
+ 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.
0
its random
0
can u please help me with the whole program. thanks so far