Hey guys, this is a simple multiple-alternative decision program. For some reason the program likes to come up with two true statements. I'll post the code below with comments as to what's happening. It's weird because if I put in 2000 as the input, the result comes out 900, but if I input 500 the program displays both 300 and 225. I've been working on this for the past 3 hours or so. I keep getting stuck. I'm thinking that it's the order of the IF statements. Any help would be greatly appreciated. Thanks guys.
well yes because else doesnt take a condition. so what the compiler really sees is:
1 2 3 4 5 6 7
else (kwh > 1000); /* it sees the kwh as a command becuase
a) it has a semicolon so it thinks it takes that as its
command and b) because else doesnt take a condition. it defeats the purpose */
//rest of code
Thanks guys! I seriously do appreciate it. I've been reading my book like crazy, but I keep interpreting things wrong. I mean if it's a conditional statement, it should stop once one scenario becomes true, but I see that's not always the case if I don't write things properly! lol