import java.io.*; public class Prog12{ [size=10.0000pt] public static void main(String[] args){ [size=10.0000pt] [size=10.0000pt] System.out.print("请输入当前利润[size=10.0000pt]:"); [size=10.0000pt] [size=10.0000pt] long profit = Long.parseLong(key_Input()); [size=10.0000pt] [size=10.0000pt] System.out.println("应发奖金[size=10.0000pt]:"+bonus(profit)); [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt] //接受从键盘输入的内容 [size=10.0000pt] private static String key_Input(){ [size=10.0000pt] [size=10.0000pt] String str = null; [size=10.0000pt] [size=10.0000pt] BufferedReader bufIn = new BufferedReader(new InputStreamReader(System.in)); [size=10.0000pt] [size=10.0000pt] try{ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] str = bufIn.readLine(); [size=10.0000pt] [size=10.0000pt] }catch(IOException e){ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] e.printStackTrace(); [size=10.0000pt] [size=10.0000pt] }finally{ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] try{ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] bufIn.close(); [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] }catch(IOException e){ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] e.printStackTrace(); [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt] [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt] [size=10.0000pt] return str; [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt] //计算奖金 [size=10.0000pt] private static long bonus(long profit){ [size=10.0000pt] [size=10.0000pt] long prize = 0; [size=10.0000pt] [size=10.0000pt] long profit_sub = profit; [size=10.0000pt] [size=10.0000pt] if(profit>1000000){ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit = profit_sub-1000000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit_sub = 1000000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] prize += profit*0.01; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt] [size=10.0000pt] if(profit>600000){ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit = profit_sub-600000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit_sub = 600000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] prize += profit*0.015; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt] [size=10.0000pt] if(profit>400000){ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit = profit_sub-400000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit_sub = 400000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] prize += profit*0.03; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt] [size=10.0000pt] if(profit>200000){ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit = profit_sub-200000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit_sub = 200000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] prize += prize*0.05; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt] [size=10.0000pt] if(profit>100000){ [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit = profit_sub-100000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] profit_sub = 100000; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt] prize += profit*0.075; [size=10.0000pt] [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt] [size=10.0000pt] prize += profit_sub*0.1; [size=10.0000pt] [size=10.0000pt] return prize; [size=10.0000pt] [size=10.0000pt]} [size=10.0000pt]} |