首页 > 代码库 > 考题分享
考题分享
2017-04-04
package cn.happy;
import java.util.Scanner;
public class Money {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
System.out.println("请输入年利润(单位万):");
double money=in.nextDouble();
if(money>=0&&money<=10){
System.out.println("您的奖金是:"+money*0.1+"万");
}else if(money>10&&money<=20){
System.out.println("您的奖金是:"+(10*0.1+(money-10)*0.075)+"万");
}else if(money>20&&money<=40){
System.out.println("您的奖金是:"+(10*0.1+10*0.075+(money-20)*0.05)+"万");
}else if(money>40&&money<=60){
System.out.println("您的奖金是:"+(10*0.1+10*0.075+20*0.05+(money-40)*0.03)+"万");
}else if(money>60&&money<100){
System.out.println("您的奖金是:"+(10*0.1+10*0.075+20*0.05+20*0.03+(money-60)*0.015)+"万");
}else{
System.out.println("您的奖金是:"+(10*0.1+10*0.075+20*0.05+20*0.03+40*0.015+(money-100)*0.01)+"万");
}
}
}
考题分享