Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. //variable declarations
  6. int iEmpID;
  7. float fEmpRate, fEmpHours, fEmpOTHours, fEmpOTRate,
  8. fEmpOTPay, fGrossPay, fEmpTaxes, fNetPay,
  9. fTotalGross, fTotalTaxes, fTotalNet, fTotalOTHours, fTotalOTPay;
  10. fTotalGross = fTotalTaxes = fTotalNet = fTotalOTHours = fTotalOTPay = 0;
  11. char cYesNo;
  12.  
  13. printf("Please enter your employee ID number: ");
  14. scanf("%d", &iEmpID);
  15. printf("Do you want to process employee records? (Y/N): ");
  16. scanf("%c", &cYesNo);
  17. while (scanf("%c", &cYesNo) != 'N') {
  18.  
  19. printf("\nPlease enter your employee ID number: ");
  20. scanf("%d", &iEmpID);
  21. printf("Enter employee's rate of pay: ");
  22. scanf("%f", &fEmpRate);
  23. printf("Enter employee's worked hours: ");
  24. scanf("%f", &fEmpHours);
  25. if (fEmpHours <=40) {
  26. fGrossPay = fEmpRate * fEmpHours;
  27. }
  28. else {
  29. fEmpOTHours = fEmpHours - 40;
  30. fEmpOTRate = fEmpRate * 1.5;
  31. fEmpOTPay = fEmpOTRate * fEmpOTHours;
  32. fGrossPay = ((fEmpOTHours)*(fEmpOTRate)) + (fEmpRate *40);
  33. }
  34. fEmpTaxes = fGrossPay * 0.172;
  35. fNetPay = fGrossPay - fEmpTaxes;
  36. fTotalOTHours = fTotalOTHours + fEmpOTHours;
  37. fTotalOTPay = fTotalOTPay + fEmpOTPay;
  38. fTotalGross = fTotalGross + fGrossPay;
  39. fTotalTaxes = fTotalTaxes + fEmpTaxes;
  40. fTotalNet = fTotalNet + fNetPay;
  41.  
  42. printf("\nThe employee's ID is: %d\n", iEmpID);
  43. printf("The employee's rate of pay was: %.2f\n", fEmpRate);
  44. printf("The employee's worked hours were: %.2f\n", fEmpHours);
  45. printf("The employee's worked OT hours were: %.2f\n", fEmpOTHours);
  46. printf("The employee's gross pay was: %.2f\n", fGrossPay);
  47. printf("The employee's OT pay was: %.2f\n", fEmpOTPay);
  48. printf("The employee's withheld taxes were: %.2f\n", fEmpTaxes);
  49. printf("The employee's net pay was: %.2f\n", fNetPay);
  50.  
  51. printf("\nDo you want to continue processing records? (Y/N): ");
  52. scanf("%c", &cYesNo);
  53. }
  54.  
  55. printf("\nThe accumulated OT hours were: %.2f\n", fTotalOTHours);
  56. printf("The accumulated OT pay was: %.2f\n", fTotalOTPay);
  57. printf("The accumulated gross pay was: %.2f\n", fTotalGross);
  58. printf("The accumulated taxes withheld were: %.2f\n", fTotalTaxes);
  59. printf("The accumulated net pay was: %.2f\n", fTotalNet);
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement