1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
import java.util.Scanner;
public class A04 {
/**
* @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 ;
switch (choice) {
case 1 :
case 2 :
case 3 :
case 11 :
case 12 :
switch (choice1) {
case 1 :
money= 5000 * 0.5 ;
break ;
case 2 :
money= 5000 * 0.4 ;
break ;
default :
System.out.println( "输入错误!" );
break ;
}
break ;
default :
switch (choice1) {
case 1 :
money= 5000 * 0.9 ;
break ;
case 2 :
money= 5000 * 0.8 ;
break ;
default :
System.out.println( "输入错误!" );
break ;
}
break ;
}
System.out.println( "您的机票价格为:" +money);
}
} |
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1420182