public static void main(String[] args) {
// TODO Auto-generated method stub
double k;
System.out.print("销售总额 "+"\t"+"酬金");
for( int i =10000;i<=100000.0;i+=5000) {
k=i*1.0;
System.out.printf("\n%5.0f\t%4.1f",k,computeCommission(k));
}
}
public static double computeCommission (double salesAmount) {
double commission= 0;
if(salesAmount<=5000.0)
commission = salesAmount*0.08;
else if(salesAmount>=5000.0100 && salesAmount<=10000.0)
commission = 5000*0.08+(salesAmount-5000)*0.10;
else if(salesAmount>10000.0)
commission = 5000*0.08+5000*0.10+(salesAmount-10000)*0.12;
return commission;
}
java语言程序设计 第十版(基础篇)6.11
最新推荐文章于 2021-02-25 14:25:04 发布