麒麟V10下Qt6无法输入中文?手动编译fcitx插件一步解决
2026/10/15 4:53:50
package com.shang; import java.util.Scanner; public class AirTicket { static void main() { int x=120;//燃油费 int y=50;//建设费 Scanner sc =new Scanner(System.in); System.out.println("请输入月份"); int mouth = sc.nextInt(); sc.nextLine(); System.out.println("请输入舱位类型"); String cabin = sc.nextLine(); System.out.println("请输入机票原价"); double originalPrice = sc.nextDouble(); double discount = getDiscount(mouth,cabin); double finalPrice = originalPrice*discount; System.out.printf("折扣:%.2f, 折后票价:%.2f\n",discount,finalPrice+x+y); sc.close(); } public static double getDiscount(int mouth,String cabin){ //判断季节 boolean isPeak = mouth>=5 && mouth<=10; if ("头等舱".equals(cabin)){ return isPeak ?0.9 :0.7; }else if ("经济舱".equals(cabin)){ return isPeak ? 0.85 :0.65; }else { throw new IllegalArgumentException("舱位类型错误,仅支持头等舱、经济舱"); } } }