...

View Full Version : Help needed with an if/else statement



sulli1
01-24-2006, 12:24 PM
Hi All,

Please could somebody offer me some help with my temperature program (attached) it runs all the variables except for the above 100 degrees, which should output 'The water has turned to steam' but it just seems to ignore this and tell me 'The water is liquid'. Where have I gone wrong??

I need this help for an assignment that has to be submitted today at the very latest, so any help would be really appreciated.

Thank you in advance.

Jenny

MRMAN
01-24-2006, 12:49 PM
Can we see what you have done. Will help to see what you have done.

sulli1
01-24-2006, 01:11 PM
Oops, sorry - that was rather silly of me, I thought I had managed to attach the program file to the message! I will try again.

Thanks again,

jenny:o

MRMAN
01-24-2006, 01:13 PM
Ok. Sorry but there was nothing in that file.

sulli1
01-24-2006, 02:51 PM
Hi MrMan,

Ok, I may need some help here then to get this file downloaded (uploaded?). I did this the other day quite easily so goodness knows what is going wrong here!! This is a program file written in Notepad, and run in Netscape - to attach it to this forum I saved it as a text (.txt) file and then as a word document for ease of reading for the majority (?) of users. I am feeling rather panicked about missing the cut off date of my uni assignment now (midnight), so would greatly appreciate all and any help offered via this forum - please!!!!

Could someone please advise how do I upload/download my file so that it can be viewed on this forum and commented on?

Huge thank you's to yourself and anyone else reading this thread that can offer assistance here.

Kindest regards,

Jenny

MRMAN
01-24-2006, 03:18 PM
Don't bother about using the files to upload to the site. just copy the code and put it between some code tags
i.e {CODE}{/CODE}
there { = shift+{

2reikis
01-24-2006, 09:39 PM
The way an if/else block works, if the if condition evaluates to true, the else is never reached.

change this statement


if (theTemperature >= 0)

to this


if ((theTemperature >= 0)&&(theTemperature<100))

and you should be good to go

sulli1
01-24-2006, 10:12 PM
Hi there,

Thank you for your help. I have less than two hours to submit my assignment now!!! Thing is, I have just run this program with the new code and it is still telling me that the water at 101 degrees is liquid as opposed to ice. Please could you offer some further help?

Thank you in advance (and anticipation)

Jenny

sulli1
01-24-2006, 10:25 PM
Hi 2reikis,

Thank you for sending me your help, I have finally been able to submit my uni assignment and am really grateful for your input.

Thank you again, big time,

Jenny
:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum