各位大神这个js代码怎么写?
1个回答
展开全部
function Drinks(name,price,amount){
this.name=name;
this.price=price;
this.amount=amount;
}
function Cola(name,price,amount){
this.Drinks=Drinks;
this.Drinks(name,price,amount);
}
function Sprite(name,price,amount){
this.Drinks=Drinks;
this.Drinks(name,price,amount);
}
var cola=new Cola(name,price,amount);
var sprite=new Cola(name,price,amount);
var totalPrice=0;
if(cola.amount>3&&sprite.amount>3){
totalPrice=(cola.price*cola.amount+sprite.price*sprite.amount)*0.8;
}else{
totalPrice=cola.price*cola.amount+sprite.price*sprite.amount;
}
追问
谢谢
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询