public class Demo3 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println(“请输入您出行的月份:”);
int month = input.nextInt();
System.out.println(“请问您选择头等舱还是经济舱?头等舱输入1,经济舱输入2”);
int type = input.nextInt();
double price = 5000.0;
if (month1 || month2 || month3 || month11 || month12) {
if (type1) {
price*=0.5;
}else if (type2) {
price*=0.4;
}
} else {
if (type1) {
price*=0.9;
} else if (type==2) {
price*=0.8;
}
}
System.out.println(“您的机票价格为:”+price);
}
}