
#include<stdio.h>
#include<stdlib.h>
#define BASEHUR 40
#define OVERTIME 1.5
#define BASE1 300
#define BASE2 150
#define TAX1 0.15
#define TAX2 0.20
#define TAX3 0.25
int main ()
{
double basepay;
double hours;
double wage = 0;
double tax ;
double j_pay;
int num; printf("Enter the number corresponging to the desired pay rate or action:\n");
printf("(1)$8.75/hr (2)$9.33/hr\t\n");
printf("(3)$10.00/hr (4)$11.20/hr\n");
printf("(5)quit\n"); while(scanf("%d", &num) ==1)
{
switch(num)
{
case 1 :
basepay = 8.75;
break;
case 2 :
basepay = 9.33;
break;
case 3 :
basepay = 10.00;
break;
case 4:
basepay = 11.20;
case 5 :
printf("quit\n");
break;
default :
printf("please enter 1 to 5.\n");
}
if(num == 1 || num == 2 || num == 3 || num == 4)
{
printf("Please enter work hours for a week.\n");
scanf("%lf", &hours);
if (hours <= BASEHUR)
wage = hours * basepay;
else
wage = BASEHUR * basepay + (hours - BASEHUR) * basepay;
if(wage <= BASE1)
tax = wage * TAX1;
else if (wage <= BASE1 + BASE2)
tax = BASE1 * TAX1 + (wage - BASE2) * TAX2;
else
tax = BASE1 * TAX1 + BASE2 * TAX2 + (wage -BASE1 - BASE2) * TAX3;
j_pay = wage - tax;
printf("basepay is %.2lf,hours is %.1lf, wage is %.2lf, tax is %.2lf, j_pay is %.2lf\n",
basepay, hours, wage, tax, j_pay);
printf("Please chance basepay again.\n");
}
else if(num == 5)
goto end;
else
continue;
}
printf("Done!\n"); end : system("pause");
return 0;
}
