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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Could someone please write out the following codes for me?

    Write an if statement that implements the following logic: a is not equal to 5 or b is greater than or equal to 20 display a message “True” Otherwise display “Not true”
    Declare the variables a and b and give them any values you wish.

    Ask the user for a value and call it Game , implement the following logic If Game has the string value Chess then print “Chess is hard.” If Game has the string value Checkers then print “Checkers is easy.” If Game has any other value print “Pick another game.”

    Ask the user for their Name, a Product and a Quantity. Output the following, “Thank you [Name] for ordering [Quantity] [Product]”. The values the user entered should be output in the places with the []. You must declare all necessary variables.

    Write a loop that keeps track of how many times the loop has run with a variable you create called Count. This loop should run at least once and ask the user if they wish to continue. After the loop is complete print the value of Count to the screen in bold (use the HTML bold tag in your output).

    Who ever does these codes for thank you very very much!

  • #2
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    http://www.codingforums.com/rules.htm especially paragraph 1.5

    -------------------------------------------------------------------------------
    "Real Programmers can write assembly code in any language" - Larry Wall

  • #3
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    There are forums, here, for paid code writing. This is primarily to help troubleshoot code that is already written but doesn't work as expected (or at all.)
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #4
    New Coder
    Join Date
    Mar 2011
    Location
    England
    Posts
    29
    Thanks
    0
    Thanked 5 Times in 5 Posts
    this is the kind of stuff you should be trying out yourself to learn, once you get into it its great fun!

    first paragraph: variable assigning and if statement

    second paragraph: read up on the prompt method, store it in a variable and use an if statement to check

    third paragraph: use a prompt for each and store them in a variable each, use alert() to print the information out using concatenation ("string" + var)

    fourth paragraph: read up on for loops, a prompt and if statement at the beginning should solve this.

    have a go at it and post what you can, im sure everyone will try and help

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    felgall would say don't encourage the guy to use obsolete prompts and alerts.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #6
    New Coder
    Join Date
    Mar 2011
    Location
    England
    Posts
    29
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Philip M View Post
    felgall would say don't encourage the guy to use obsolete prompts and alerts.
    Would you suggest using getElementById to change/grab an elements value or text instead? i guess he could use console.log to debug but i still think alert can be useful.

  • #7
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by stevehungry View Post
    Would you suggest using getElementById to change/grab an elements value or text instead? i guess he could use console.log to debug but i still think alert can be useful.
    I don't disagree - but I did say that felgall might quibble! Alerts are really intended for debugging these days. Console.log only works in Firefox and Chrome. It will throw an error in IE.

    I would prefer (but not insist) to get off on the right foot and use textboxes with an id for input, and <spans> or<divs> for displaying results and/or messages. Use document.getElementById("myelement").value for textboxes or .innerHTML for spans/divs.

    The trouble with the old-fashioned methods is that the OP will soon have to unlearn them.
    Last edited by Philip M; 04-02-2013 at 05:36 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Tags for this Thread

    Posting Permissions

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