您的位置:首页 > 其它

第三章练习题

2018-03-27 20:42 155 查看
//飞机票练习题
package soup;
import java.util.Scanner;
public class Plane {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("请输入你的月份:");
int month = input.nextInt();
double money = 5000;
System.out.println("请选择是经济舱还是头等舱:1为头等舱,2为经济舱");
int xuanze = input.nextInt();
if (month >= 4 && month <= 10) {
if (xuanze == 1) {
money = money * 0.9;
} else {
money = money * 0.8;
}

} else {
if (xuanze == 1) {
money = money * 0.5;
} else {
money = money * 0.4;
}
}
System.out.println("您的机票价格是:" + money);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: