2012JAVA模拟试题及答案:编程题12
【程序12】题目:企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可可提成7.5%;20万到40万之间时,高于20万元的部分,可提成5%;40万到60万之间时高于40万元的部分,可提成3%;60万到100万之间时,高于60万元的部分,可提成1.5%,高于100万元时,超过100万元的部分按1%提成,从键盘输入当月利润,求应发放奖金总数?
import java.util.*;
public class lianxi12 {
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 && x10 && x20 && x40 && x60 && x100) {
y = 20 * 0.175 + 40 * 0.08 + 40 * 0.015 + (x - 100) * 0.01;
}
System.out.println("应该提取的奖金是 " + y + "万");
}
}
页:
[1]