Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Could someone please write out the following codes for me?

1. ## 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. http://www.codingforums.com/rules.htm especially paragraph 1.5

3. 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.)

4. 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. felgall would say don't encourage the guy to use obsolete prompts and alerts.

6. Originally Posted by Philip M
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. Originally Posted by stevehungry
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.