已知某公司员工的工资底薪为500,员工销售的软件金额与提成方式如下:
销售额 ≤2000 没有提成
2000 < 销售额 ≤ 5000 提成8%
5000 < 销售额 ≤ 10000 提成10%
销售额 > 10000 提成12%
利用switch
*/
#include <stdio.h>
int main()
{
double basicSalary = 500;//底薪
double commission = 0; //提成
double wage; //工资
wage = basicSalary + commission;
int sales = 0; //销售额
printf("请输入销售额\n");
scanf("%d", &sales);
switch (sales/1000) {
case 1:
case 2:
break;
case 3:
case 4:
case 5:
commission = sales * 0.08;
break;
case 6:
case 7:
case 8:
case 9:
case 10:
commission = sales * 0.1;
break;
default:
commission = sales * 0.12;
}
printf("综合工资是:%.2f\n", wage);
return 0;
} |
|