جاوا اسکریپت برای طراحان وب تمرین بلیط فروشی
var city=prompt("Inter city :") ;
var tedad=prompt("Tedad mosaferan :") ;
var price=prompt("Inter price :") ;
var tedadType=Number(tedad) ;
var priceType=Number(price) ;
if (city=="teh"||city=="isf"||city=="yu") {
if (tedadType==1) {
var morePrice=tedadType*priceType ;
var takhfif=morePrice*0.99 ;
alert(takhfif)
}
else if (tedadType==2) {
var morePrice=tedadType*priceType ;
var takhfif=morePrice*0.98 ;
alert(takhfif)
}
else if (tedadType==3) {
var morePrice=tedadType*priceType ;
var takhfif=morePrice*0.97 ;
alert(takhfif)
}
else if (tedadType==4) {
var morePrice=tedadType*priceType ;
var takhfif=morePrice*0.96 ;
alert(takhfif)
}
else if (tedadType>=5) {
var morePrice=tedadType*priceType ;
var takhfif=morePrice*0.95 ;
alert(takhfif)
}
} else {
alert("The city in question has no discount!")
} ;
سلام استاد عنایتی خسته نباشید…
این تمرین بلیط فروشی .
ازتون بسیار ممنوووونم
بالاخره بعد مدتی از امتحانا تونستم یه سر به کامپیوتر بزنم و حداقل یک تمرینو حل کنم … واقعا پوزش بابت تاخیر
مرسییی ازتون خدانگهدارتوون
1 پاسخ
- Saleh .a25 دي ۱۴۰۰
var city=prompt("Inter city :") ; var tedad=prompt("Tedad mosaferan :") ; var price=prompt("Inter price :") ; var tedadType=Number(tedad) ; var priceType=Number(price) ; if (city=="teh"||city=="isf"||city=="yu") { if (tedadType==1) { var morePrice=tedadType*priceType ; var takhfif=morePrice*0.99 ; alert(takhfif) } else if (tedadType==2) { var morePrice=tedadType*priceType ; var takhfif=morePrice*0.98 ; alert(takhfif) } else if (tedadType==3) { var morePrice=tedadType*priceType ; var takhfif=morePrice*0.97 ; alert(takhfif) } else if (tedadType==4) { var morePrice=tedadType*priceType ; var takhfif=morePrice*0.96 ; alert(takhfif) } else if (tedadType>=5) { var morePrice=tedadType*priceType ; var takhfif=morePrice*0.95 ; alert(takhfif) } } else { alert("The city in question has no discount!") } ;استاد این هم کد ها مرتب تر ممنون
