嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
订票小程序,应用到类的定义与使用
public double sgPrice = 70;//深圳到广州的票价
public double gxPrice = 90;//广州到香港的票价
public double sxPrice = 160;//深圳到香港的票价
public double ticketPrice = 0;//定义一个基本票价
public Customer customer = new Customer();
public double foodCost;//定义一个特殊餐饮
public double insuranceCost;//定义一个保险价格
public void SetSpecialfoodandbeverage(bool specialFoodandBeverage)//设置特殊餐饮
{
if (specialFoodandBeverage)
foodCost = 20;
else
foodCost = 0;
}
public void SetPurchaseinsurance(bool purchaseInsurance)//设置购买保险
{
if (purchaseInsurance)
insuranceCost = 15;
else
insuranceCost = 0;
}
public double CalculateCost()
{
double totalCost = ticketPrice foodCost insuranceCost;
if (customer.memberOption)
{
totalCost = ticketPrice * 0.8 foodCost insuranceCost;
return totalCost;
}
else
return totalCost;
}