#include <stdio.h>

#define n1 0.15 //tax1
#define n2 0.28

#define m1 17850
#define m2 23900
#define m3 29750
#define m4 14875


int main() {
    int m,sw,swt,exit;
    float d,tax;
    exit = swt = 1;
    while(exit){
        do{
                printf("Choose tarif:\n");
                printf("1) odin\t2) main\n");
                printf("3) brak sov\t4) Brak razd\n");
                printf("5) exit\nInput: ");
                sw = getchar();
                switch(sw){
                    case '1': m = m1; swt = 0; break;
                    case '2': m = m2; swt = 0; break;
                    case '3': m = m3; swt = 0; break;
                    case '4': m = m4; swt = 0; break;
                    case '5': exit = 0; break;
                }
            }while(swt&&exit);
        if(exit){
            printf("dohod: ");
            scanf("%f",&d);
            while(getchar() != '\n');
        
            if (d>m){tax = ((m*n1)+((d-m)*n2));}
            else (tax = (d*n1));

            printf("Tax: %.2f\n\n\n",tax);
        }}
  return 0;
}
