Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jan 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help needed with an if/else statement

    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

  • #2
    Regular Coder
    Join Date
    Jan 2006
    Location
    Preston, Lancashire, England
    Posts
    285
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can we see what you have done. Will help to see what you have done.

  • #3
    New Coder
    Join Date
    Jan 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Attached Files Attached Files

  • #4
    Regular Coder
    Join Date
    Jan 2006
    Location
    Preston, Lancashire, England
    Posts
    285
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok. Sorry but there was nothing in that file.

  • #5
    New Coder
    Join Date
    Jan 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    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
    Attached Files Attached Files

  • #6
    Regular Coder
    Join Date
    Jan 2006
    Location
    Preston, Lancashire, England
    Posts
    285
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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+{

  • #7
    Regular Coder 2reikis's Avatar
    Join Date
    Nov 2005
    Location
    California
    Posts
    167
    Thanks
    17
    Thanked 13 Times in 13 Posts

    if/else behaviour

    The way an if/else block works, if the if condition evaluates to true, the else is never reached.

    change this statement

    Code:
     if (theTemperature >= 0)
    to this

    Code:
     if ((theTemperature >= 0)&&(theTemperature<100))
    and you should be good to go

  • #8
    New Coder
    Join Date
    Jan 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #9
    New Coder
    Join Date
    Jan 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •