Hi everyone, I just started on learning java and I have this problem I'm trying to figure out.
The question is asking me to have my program read the twelve temperature values and print the month with the highest temperature.
This is what I have so far:
public static void main(string[] args)
{
double highestValue;
highestValue = in.nextDouble();
int highestMonth=1;
for (int currentMonth = 2; currentMonth <= 12; currentMonth++)
{
double nextValue = in.nextDouble();
if (nextValue > highestValue)
{
highestValue = nextValue;
highestMonth = currentMonth;
}
}
System.out.println(highestMonth);