java基础(第三章课后作业)06

 1 package com.variable;
 2 
 3 import java.util.Scanner;
 4 
 5 public class ZuoYe06 {
 6 
 7 
 8     public static void main(String[] args) {
 9         Scanner meng00=new Scanner(System.in);
10         int ticket=5000;
11         System.out.println("请输入您出行的月份1~12");
12         int season=meng00.nextInt();
13         
14         System.out.println("请问您选择头等舱还是经济舱?头等舱输入1,经济舱输入2");
15         int cang=meng00.nextInt();
16         
17         if (season>=4&&season<=10) {
18             if (cang==1)
19             {
20                 System.out.println("你的机票价格为:"+ticket*0.9);//旺季头等舱
21                 
22             }else{
23                 System.out.println("你的机票价格为:"+ticket*0.8);//旺季经济舱
24             }
25         }else{
26             if (cang==1)
27             {
28                 System.out.println("你的机票价格为:"+ticket*0.5);//淡季头等舱
29                 
30             }else{
31                 System.out.println("你的机票价格为:"+ticket*0.4);//淡季经济舱
32             }
33         }
34 
35         
36         
37         
38         /*
39         if (season>=4&&season<=10 || ) 
40         {
41             System.out.println("请问您选择头等舱还是经济舱?头等舱输入1,经济舱输入2");
42             int cang=meng00.nextInt();
43             if (cang==1)
44             {
45                 System.out.println("你的机票价格为:"+ticket*0.9);//旺季头等舱
46                 if (season<4 && season>10) {
47                     
48                 }
49                 System.out.println("你的机票价格为:"+ticket*0.5);//淡季头等舱
50             }else{
51                 System.out.println("你的机票价格为:"+ticket*0.8);//旺季经济舱
52                 System.out.println("你的机票价格为:"+ticket*0.4);//淡季经济舱
53             }
54         }
55         */
56         
57     
58 }
59 }

 

posted @ 2017-11-15 16:56  吉祥龙龙  阅读(320)  评论(0)    收藏  举报