import java.util.Scanner;
public class Test {
public static void main(String[] args) {
// 提示
System.out.println("请输入您的利润?");
// 定义变量,用来保存利润、奖金
double money = 0, price = 0;
// 接收并赋值
Scanner scanner = new Scanner(System.in);
money = scanner.nextLong();
// 使用if进行判断
if (money <= 100000) {
price = money * 0.01;
} else if (money <= 200000 && money > 100000) {
price = (money - 100000) * 0.075 + 100000 * 0.01;
} else if (money <= 400000 && money > 200000) {
price = (money - 200000) * 0.05 + 100000 * 0.075 + 100000 * 0.01;
} else if (money <= 600000 && money > 400000) {
price = (money - 400000) * 0.03 + 200000 * 0.05 + 100000 * 0.075
+ 100000 * 0.01;
} else if (money <= 1000000 && money < 600000) {
price = (money - 600000) * 0.015 + 200000 * 0.03 + 200000 * 0.05
+ 100000 * 0.075 + 100000 * 0.01;
} else {
price = (money - 1000000) * 0.01 + 400000 * 0.015 + 200000 * 0.03
+ 200000 * 0.05 + 100000 * 0.075 + 100000 * 0.01;
}
System.out.println("您的奖金计算为:" + price + "元!");
}
}
35-算奖金
最新推荐文章于 2018-06-20 10:32:03 发布