what is wrong with my code??(simple javaScript)

2006-11-02 2:00 pm
(I skiped some parts ,since it can't be displayed)

function ticket(age)
{var result
if ( age >= 18 ){result=10}
else{result=8}
return result}

const gstRate = 0.06
var pstRate = 0
var gst, pst, ticketCost, totalCost, age,ticket

pstRate = inputNum("PST rate ", 0.08)
age = inputNum("How old are you", 18)

ticketCost = ticket(age)
gst = ticketCost * gstRate
pst = ticketCost * pstRate
totalCost = ticketCost + gst + pst

回答 (1)

2006-11-02 4:40 pm
✔ 最佳答案
What is the problem?
It is supposed to return totalCost=11.40
Perhaps your problem is elsewhere.


收錄日期: 2021-04-12 20:07:31
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20061102000051KK00472

檢視 Wayback Machine 備份