第三章练习题
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);
}
}
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);
}
}
相关文章推荐
- C++ Primer Plus 第三章练习题
- 数据结构与算法MOOC / 第三章 栈与队列 练习题 8:抓住那头牛
- 深入理解计算机系统 - 练习题 - 第三章 (练习题3.32)
- 自考(2017年版)《操作系统》——第三章思考题与练习题参考答案(自做)
- Opencv第三章练习题答案
- 深入理解计算机系统 - 练习题 - 第三章(练习题3.33)
- Java疯狂讲义第三章练习题
- Thinking in Java 第四版完整版 第三章练习题
- Python核心编程(第二版)第三章练习题
- C.Primer.Plus(第6版)第三章第4道练习题
- 《C Primer Plus》(第五版)第三章编程练习题源代码
- C语言程序设计-现代方法----示例及练习题----第三章--格式化输入输出
- 第三章 栈和队列练习题
- 疯狂java 讲义第三章练习题---画圆
- 《Python编程》第三章部分课后练习题
- 第三章练习题
- 第三章课后练习题
- C语言程序设计 练习题参考答案 第三章 (2) 选择结构
- <<疯狂Java讲义>>练习题- 第三章 画近似圆
- ISLR第三章线性回归应用练习题答案(下)