用 switch case 修改 7:如图


//用 switch case 修改 7:基本工资 10.00 美元/小时 加班(超过40小时)1.5倍时间 税率 前300美元为%15 下一个150美元为%20 余下的为%25 不关心是否符合税法
#include "stdafx.h"
#include "stdlib.h"
#define LTR 0.15
#define STR 0.2
#define OTR 0.25
int main()  
{  
	int time,a,b,i,sum=0,r;
	double x=0.0,y=0,z=0,BS;
	double ave=0;
	printf("\aEnter the numbercorresponding to the desired pay rate or action:\n");
	for(i=0;i<=63;i++)
		printf("*");
	printf("\n");
	printf("1)$8.75/hr\t\t\t\t\t2)$9.33/hr\n3)$10.00/hr\t\t\t\t\t4)11.20/hr\n5)quit\n");
	for(i=0;i<=63;i++)
		printf("*");
	printf("\n");
	scanf("%d",&r);
	switch(r)
	{
		case 1:BS=8.75;break;
		case 2:BS=9.33;break;		
		case 3:BS=10.00;break;
		case 4:BS=11.20;break;
		case 5:goto A; 
	}
	printf("\aPlease input the times:_____\b\b\b\b\b");
	scanf("%d",&time);

	if(time>40)
	{
		time*=BS;
		sum+=(BS*1.5)*time;
	}
	else
		sum=time*=BS;
	printf("\aThe wage is %d\n",sum);

	a=sum-300;
	b=a-150;
	x=b*OTR;
	y=(sum-a)*LTR;
	z=(sum-b)*STR;
	if(sum>300)
		printf("Tax is %0.2f\n",x+y+z);
	else
		printf("Need not pay tax\n");
	printf("Net salary is %0.2f\n",sum-(x+y+z));
	system("pause");
    return 0;
A:	printf("NULL\n");
	system("pause");
}


你可能感兴趣的:(null,System,input,action)