Basically, if I run the program below, the output line is blank..I honestly have no idea what to do, and I need this done. I don't want anyone to do it with me (unless i'm desperate), I just need some pointers, samples, examples, etc.
The output line is blank because your program is stuck in an infinite loop.
You're not supposed to use a while loop for a single execution. Now, the value of "vehicle" will NEVER change, so once it enters a loop, it will never exit. Replace with if statements (or a switch).
...
//if vehicle == C it will go inside... but when does the loop finish?
//(When is vehicle different from 'C' or 'c' ?
//as the value never changes... it will stay inside the loop forever
while(vehicle == 'C' || vehicle == 'c') {
if(hours <= 3) {
cost = 0;
}
else {
cost = hours * 1.5;
}
}
...
[/b]
First why are u using a 3 while loops?
As gaminic said you should use a switch or some ifs...
The point is...
Consider that Vehicle value = 'C'
As it never changes inside the while loop it wont go out of the while so it would be an infinite loop.