标签:java-第四章-机票价格受到淡季旺季的影响 编写的小程序
import java.util.Scanner;
public class A02 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner (System.in);
System.out.println("请输入月份:1~12");
int choice=input.nextInt();
System.out.println("请问您是选择头等舱还是经济舱?头等舱输入1,经济舱输入2.");
int choice1=input.nextInt();
double money=0;
if(choice>=4&&choice<=10){
switch (choice1) {
case 1:
money=5000*0.9;
break;
case 2:
money=5000*0.8;
break;
default:
System.out.println("输入有误!");
break;
}
}else{
switch (choice1) {
case 1:
money=5000*0.5;
break;
case 2:
money=5000*0.4;
break;
default:
System.out.println("输入有误!");
break;
}
}
System.out.println("您的机票价格为:"+money);
}
}java-第四章-机票价格受到淡季旺季的影响,编写的小程序,布布扣,bubuko.com
标签:java-第四章-机票价格受到淡季旺季的影响 编写的小程序
原文地址:http://1797077217.blog.51cto.com/8956560/1420175