Import Java.util.Scanner;
public class Seventheen {
/* Bonuses awarded by enterprises are subject to profit. Profit (I) less than or equal to $100,000, the bonus can be raised by 10%, the profit is higher than $100,000, less than $200,000, less than 100,000 of the portion of the 10% commission, higher than the portion of 100,000 yuan, Cocoa Commission 7.5%, 200,000 to 400,000, higher than 200,000 yuan of the portion, can commission 5% ; Between 400,000 and 600,000 is higher than the portion of 400,000 yuan, can commission 3%, 600,000 to 1 million, higher than 600,000 yuan portion, can commission 1.5%, higher than 1 million yuan, the portion of more than 1 million yuan by 1% Commission, from the keyboard input month profit I, the total bonus should be issued? */
public static void Main (string[] args) {
Scanner input=new Scanner (system.in);
System.out.println ("Please enter profit for the month:");
int A=input.nextint ();
int b,c;
C=a;
Double sum=0;
while (a!=0) {
if (a>100) {
b=a-100;
sum=sum+b*0.01;
a=100;
}
else if (a>60) {
b=a-60;
sum=sum+b*0.015;
a=60;
}
else if (a>40) {
b=a-40;
sum=sum+b*0.03;
a=40;
}
else if (a>20) {
b=a-20;
sum=sum+b*0.05;
a=20;
}
else if (a>10) {
b=a-10;
sum=sum+b*0.075;
a=10;
}
else {
sum=sum+a*0.1;
a=0;
}
}
SYSTEM.OUT.PRINTLN (c+ "Profit is:" +sum);
}
}
Java Basics Exercise 17