topic:
The bonus issued by the enterprise is based on the profit commission. When the profit is less than or equal to 100,000 yuan, the bonus can be increased by 10%; when the profit is more than 100,000 yuan, and when the profit is less than 200,000 yuan, the portion of less than 100,000 yuan will be commissioned at 10%, and the portion of more than 100,000 yuan. The commission can be 7.5%;
between 200,000 and 400,000, the part higher than 200,000 yuan can be commissioned 5%;
between 400,000 and 600,000, the part higher than 400,000 yuan can be commissioned 3%;
600,000 When it is between RMB 1 million, the part higher than RMB 600,000 will receive a commission of 1.5%. When it is higher than RMB 1 million, the part exceeding RMB 1 million will be commissioned at a 1% commission. Enter the monthly profit from the keyboard. What is the total amount of bonuses that should be paid?
import java.util.*;
public class CompanyProfit{
public static void main(String[] args) {
double x = 0,y = 0;
System.out.print("输入当月利润(万):");
Scanner s = new Scanner(System.in);
x = s.nextInt();
if(x > 0 && x <= 10) {
y = x * 0.1;
} else if(x > 10 && x <= 20) {
y = 10 * 0.1 + (x - 10) * 0.075;
} else if(x > 20 && x <= 40) {
y = 10 * 0.1 + 10 * 0.075 + (x - 20) * 0.05;
} else if(x > 40 && x <= 60) {
y = 10 * 0.1 + 10 * 0.075 + 20 * 0.05 + (x - 40) * 0.03;
} else if(x > 60 && x <= 100) {
y = 20 * 0.175 + 20 * 0.05 + 20 * 0.03 + (x - 60) * 0.015;
} else if(x > 100) {
y = 20 * 0.175 + 40 * 0.08 + 40 * 0.015 + (x - 100) * 0.01;
}
System.out.println("应该提取的奖金是 " + y + "万");
}
}