import java.util.Scanner;
public class w {
public static void main(String[] args) {
int yf,jg=5000,c;
double qian=5000;
System.out.println("请输入您出行的月份");
Scanner a=new Scanner(System.in);
yf=a.nextInt();
if (yf >= 4 && yf <= 10) {
System.out.println("请您选择头等舱还是经济舱?头等舱输入1,经济舱输入2.");
Scanner q = new Scanner(System.in);
c = q.nextInt();
if (c == 1) {
qian = jg * 0.9;
} else if (c == 2) {
qian = jg * 0.6;
} else {
System.out.println("输入错误!请输入1或2,头等舱输入1,经济舱输入2");
}
} else if (yf >= 1 && yf <= 12) {
System.out.println("请您选择头等舱还是经济舱?头等舱输入1,经济舱输入2.");
Scanner q = new Scanner(System.in);
c = q.nextInt();
if (c == 1) {
qian = jg * 0.5;
} else if (c == 2) {
qian = jg * 0.4;
} else {
System.out.println("输入错误!请输入1或2,头等舱输入1,经济舱输入2");
}
} else {
System.out.println("输入错误!请输入正确的月份!");
}
System.out.println("您的机票为"+qian);
}
}
请输入您出行的月份
4
请您选择头等舱还是经济舱?头等舱输入1,经济舱输入2.
1
您的机票为4500.0
进程已结束,退出代码为 0