/* Write a C program that accepts an employees tax threshold, 
 * total worked hours for a week and the amount he received per hour. 
 * Print the employee's salary in a week (with two decimal places) 
 * after tax and including 8% holiday pay */

#include <stdio.h> 

int main(void) {

  int hour;
  double amountPerHour, tax, holidayPayTax = 8;

  printf("What is your tax threshold in %%: ");
  scanf("%lf", &tax);

  printf("Hours worked this week: ");
  scanf("%d", &hour);

  printf("Pay per hour: $");
  scanf("%lf", &amountPerHour);

  /* Calculation for the Percent Portion: 
   * endTotal = tax * total */
  double total = hour * amountPerHour;
  double percentDeduction = tax * total;
  double percentConvert = tax / 100;
  double totalTax = percentConvert * total;
  double endTotal = total - totalTax; 
  
  printf("Total before Holiday Pay: $%.2lf\n", endTotal);

  /* calculation of 8% holiday pay */
  double holidayPay = holidayPayTax * total;
  double holidayPayConvert = holidayPayTax / 100;
  double totalHolidayPayTax = holidayPayConvert * total;

  /* 17.5% tax ontop of Holiday Pay */
  double holidayPayAfterTax = tax * totalHolidayPayTax;
  double holidayConvert = tax / 100;
  double totalHolidayTax = holidayConvert * totalHolidayPayTax;
  double holidayPayFinal = totalHolidayPayTax - totalHolidayTax;

  printf("Your 8%% holiday pay after tax is: $%.2lf\n",  holidayPayFinal);

  double takeHomePay = endTotal + holidayPayFinal;
  printf("Total pay for the week: $%.2lf\n", takeHomePay);

    return 0;
}

//BUILD ON THIS BY CREATING YOUR OWN FUNCTION TO WORKOUT DIFFERENT TAX AMOUNT BASED ON ARGUMENT IN FUNCTION