package com.itheima.anli; public class Anli1 { public static void main(String[] args) { calculate(1000,8,"经济舱"); System.out.println( calculate(1000,8,"经济舱")); } public static double calculate(double price,int month,String type){ if(month>=5&&month<=10){ switch (type){ case "头等舱": price *=0.9; break; case "经济舱": price *=0.85; break; } } else { switch (type){ case "头等舱": price *=0.7; break; case "经济舱": price *=0.65; break; } } return price; } }
标签:JAVA,calculate,飞机票,month,案例,static,经济舱,public,String From: https://www.cnblogs.com/pengsuoqun123/p/18045668