package com.fqs.test; public class hello { public static void main(String[] args) { //卖飞机票 //机票的价格按照第一 淡11月到4月、旺季5月到10月; // 第二 头等舱 旺季 9折、经济舱旺季 8.5折收费 // 第二 头等舱 淡季7折、经济舱旺季 6.5折收费 //输入机票原价 月份 头等舱 经济舱 显示售价 double price=1000; int mouth=4; int cang=1; System.out.println("打完折的价格:"+getPrice(price,mouth,cang)); } public static double getPrice (double price,int mouth,int cang) { double zhePrice=1; if(cang==1){//头等舱 if(mouth>=5&&mouth<=10){ zhePrice=price*0.9; }else{ zhePrice=price*0.7; } }else{//经济舱 if(mouth>=5&&mouth<=10){ zhePrice=price*0.85; }else{ zhePrice=price*0.65; } } return zhePrice; } }//类结束