#include<stdio.h>
#include<stdlib.h>
#define MTIME 1.5
#define RATE 0.15
#define RATE1 0.20
#define RATE2 0.25
void cal(float basic);

int main(void)
{
    char ch;
    while(1)
    {
        printf("\n*********************************************************************\n");
        printf("  * Enter the number corresponding to the desired pay rate or action: *\n");
        printf("  * 1)$8.75/hr                            2)9.33/hr                   *\n");
        printf("  * 3)$8.75/hr                            4)9.33/hr                   *\n");
        printf("  * 5)quit                                                            *\n");
        printf("  *********************************************************************\n\n");
        fflush(stdin);


        ch = getchar();
        fflush(stdin);
        switch(ch)
        {
            case '1':cal(8.75); break;
            case '2':cal(9.33); break;
            case '3':cal(10.00);break;
            case '4':cal(11.20);break;
            case '5':puts("Bye!\n");
                     exit(0);break;
            default:puts("the choice only between 1--5,try again!\n");
        }
    }
     return 0;
}
void cal(float basic)
{
     float hour = 0,tax = 0,salary = 0,sum = 0;
     printf("how many hour you have worked:\n");
     while(scanf("%f",&hour)!=1)
        puts("sorry,try again!\n");
        fflush(stdin);
     if(hour <= 40)
        sum = hour * basic;
     else
        sum = hour * basic + (hour-40) * 1.5 * basic;
     if(sum < 300)
     {
        tax = sum * RATE;
        salary = sum - tax;
     }
      else if(sum <= 450)
     {
        tax = 300 * RATE + (sum - 300) * RATE1;
        salary = sum - tax;
     }
     else
     {
         tax = 300 * RATE + 300 * RATE1 + (sum -450) * RATE2;
         salary = sum - tax;
     }
     printf("you have worked %.2f hours\nsalary total:%.2f\ntax:%.2f\nnet salary:%.2f\n",hour,sum,tax,salary );
}