#Beginner JAVA - if / else statements
4 messages · Page 1 of 1 (latest)
The prompt above
My current approach is to setup 2 sets of variables, set 1 and set 2 for temp/rain/humidity
My question is regarding the outcome result, now obviously - depending on the input, all 3 of rain, humidity and temp are rated from 3-2-1, my approach was as follows:
if ((temperature >= 15) || (temperature <= 25)) {
sTemp1 = 3;
} else if (temperature < 15) {
sTemp1 = 2;
} else {
sTemp1 = 1;
}
if ((rain >= 0 ) || (rain <= 3)) {
sRain1 = 3;
} else if ((rain >= 4) || (rain <= 8)) {
sRain1 = 2;
} else {
sRain1 = 1;
}