ls1783047205

Java编程语言基础 第三章 坐飞机票价

package cn.save;
import java.util.Scanner;
public class Dome5 {
public static void main(String[] args){
Scanner input = new Scanner(System.in);

System.out.println("请输入月份:");
int month = input.nextInt();
int yj=5000;

if(month>12 || month<1){//保障输入的是1-12月
System.out.println("输出月份不合理:");
}else if(4<=month && month>=10){

System.out.println("请问您选择头等舱还是经济舱?头等舱输入1,经济舱输入2");
int sz = input.nextInt();
if(sz==1){
System.out.println(yj*0.9);
}else if(sz==2){
System.out.println(yj*0.8);
}

}else if(4>month || month<10){
System.out.println("请问您选择头等舱还是经济舱?头等舱输入1,经济舱输入2");
int sz = input.nextInt();
if(sz==1){
System.out.println(yj*0.9);
}else if(sz==2){
System.out.println(yj*0.8);
}

}

}
}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-10-08
  • 2021-08-03
  • 2021-09-25
  • 2021-06-11
  • 2021-09-28
  • 2021-08-28
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2022-02-18
  • 2021-08-18
  • 2022-12-23
  • 2021-08-04
  • 2021-12-30
相关资源
相似解决方案