Hi. My name's Brianne and I just now started this semester taking Programming, Logic and Design. I have a homework problem, and what blows is this class is online, so I have to read the book, and write 100 times to get something down ... and I just don't get it.
Basically, I have to debug this code and I don't even know what kind of language it's in. The specific instructions were:
"This pseudocode segment is intended to describe computing the number of miles per gallon you get with your automobile. The pgoram segment should continue as long as the user enters a positive value for miles traveled.":
input gallonsOfGasUsed input milesTraveled while milesTraveled > 0 milesPerGallon = gallonsOfGasUsed / milesTraveled print milesPerGal endwhile
I'm thinking that I have to put "do" before the input and then indent the input, but I'm not totally sure. So, this is what I got:
input gallonsOfGasUsed [B]do[/B] input milesTraveled while milesTraveled > 0 milesPerGallon = gallonsOfGasUsed / milesTraveled print milesPerGal endwhile
I'm looking at the code examples in the book and they look like:
do pay bills while more bills remain to be paid
pay bills while there are more bills to pay pay bills endwhile
So, I'm thinking now maybe it's supposed to be modeled after the second one because of the endwhile:
input gallonsOfGasUsed input milesTraveled do milesPerGallon = gallonsOfGasUsed / milesTraveled while milesTraveled > 0 print milesPerGal endwhile
I'm not sure, though. Everyone who has taken this class before me told me they never had to debug anything. I think teachers are assuming that we all can code fairly well before we come into Programming, Logic and Design and that's just not it.
-_- Thanks for looking!