Wednesday, 17 October 2012

Outcome - Task 4

Task 4 was definitely more of a challenge with alot more code needed to get the succesful outcome. I almost had it but had to get some help from trusty codedotblog.blogspot.com.au. I couldn't quite get the name to repeat and paste into the final answer! but now it works!!

// TASK 4 - Liam Edleston

var name= prompt("What is your name?")

var number1= parseInt(prompt("Enter the first number"))

var symbol= prompt("Enter the Chosen Symbol(+,* or -)")

var number2= parseInt(prompt("Enter the second number"))

if (symbol=== "+")
{
    alert("Congratulations " +name+ " The Answer is "+(number1+number2))
}
else if (symbol === "*")
{
    prompt("Congratulations "+name+ " The Answer is "+number1*number2)
}
else if (symbol === "-")
{
    prompt("Congratulations "+name+" The Answer is"+number1-number2)
}

// END



No comments:

Post a Comment