web123456

Java_The bonuses issued by enterprises are based on profit commission...

package cn.myAlgorithm; import java.util.Scanner; //The bonuses issued by the enterprise are based on the profit commission. //When the profit (I) is less than or equal to RMB 100,000, the bonus can be increased by 10%; // When the profit is higher than 100,000 yuan and less than 200,000 yuan, the part below 100,000 yuan will be charged a 10% commission. //For those above 100,000 yuan, the cocoa commission will be 7.5%; //When it is between 200,000 and 400,000 yuan, the commission of the part above 200,000 yuan can be 5%; //The commission of the part above 400,000 to 600,000 yuan can be 3%; //When it is between 600,000 and 1 million, the commission of the part above 600,000 yuan can be 1.5%. //When it is higher than 1 million yuan, the part that exceeds 1 million yuan will be charged a 1% commission. //Enter the profit of the month from the keyboard and find the total number of bonuses to be paid class Bonus { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please enter the total profit (ten thousand yuan):"); double p = scanner.nextDouble(); double b = 0; if (p <= 10) { b = 0.1 * p; } else if (p <= 20) { b = 0.1 * 10 + (p - 10) * 0.075; } else if (p <= 40) { b = 0.1 * 10 + 0.075 * 10 + (p - 20) * 0.05; } else if (p <= 60) { b = 0.1 * 10 + 0.075 * 10 + 20 * 0.05 + (p - 40) * 0.03; } else if (p <= 100) { b = 0.1 * 10 + 0.075 * 10 + 20 * 0.05 + 20 * 0.03 + (p - 60) * 0.015; } else { b = 0.1 * 10 + 0.075 * 10 + 20 * 0.05 + 20 * 0.03 + 40 * 0.015 + (p - 100) * 0.01; } System.out.println("Bonus (10,000 yuan):" + b); } }