Nevermind, i got all of it...
Last thing I'd like assistance with if anybody is willing is with my print statement. I am supposed to print my variable i (years) vertically, followed by the values of the temp for all 12 months inside my for loop. I can't figure out how that would happen now, at least without printing my i variable 12 times, which isn't ideal. Revised code:
class Weather
{
public static void main(String[] args)
{
// declare variables
int i = 1; // represents year
double temp = 0.0;
final double ANNUAL_INCREASE = 1.0;
double uncertainty = 0.0;
String result = " ";
System.out.println(" Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
while(true)
{
if (i > 5) break;
if (i == 3)
{
i++;
continue;
}
switch (i)
{
case 1:
uncertainty = 2.1;
break;
case 2:
uncertainty = 4.3;
break;
case 4:
uncertainty = 7.4;
break;
case 5:
uncertainty = 8.6;
break;
default:
uncertainty = 0;
break;
} // end of switch statement
for (int j = 1 ; j <= 12 ; j++)
{
temp = j <= 10 && j > 2 ? 5*j + 7 : j + 3;
temp += (i-1) * ANNUAL_INCREASE;
temp *= (1 + uncertainty/100.0);
System.out.print(result + i + result + (int)temp + result); // Test results for now
}
//System.out.println(i);
i++;
}// end of while loop
}
}
And the output i get is expected (but not desired)
Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1 4
1 5
1 22
1 27
1 32
1 37
1 42
1 47
1 53
1 58
1 14
1 15
2 5
2 6
2 23
2 29
2 34
2 39
etc
etc
So, it is printing the year, followed by temperature just like I asked it to, but obviously i want year/month and temp to line up. Is there a way to get around this inside of the for loop? I think it sounds crazy myself, but these are my teachers words exactly: "Inside the 'for loop', concatenate temperature values for all 12 months with spaces in between, assign it to 'result' and display in one line along with the Year i. Repeat for years 1, 2, 4 and 5. Try to align the output with the Month headers by manipulating the blank space in between."
Anybody out there?????