Advertisement
Guest User

Untitled

a guest
Jul 11th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7. float wage = ('\0');
  8. float hours = ('\0');
  9. float basepay = (wage*hours);
  10. float OTpay = ('\0');
  11. float grosspay = (basepay);
  12. float tax = ('\0');
  13. float netpay = ('\0');
  14. int loopcount = ('\0');
  15. int i;
  16. char name[20];
  17. char q[20];
  18. strcpy_s(q, "quit");
  19. //inputs
  20. for (i = 0; i < 5; i++)
  21. {
  22. printf("Enter name: ");
  23. scanf_s("%s", &name, 20);
  24. if (strcmp(name,q) == -1)
  25. return;
  26. printf("Enter hourly rate: ");
  27. scanf_s("%f", &wage);
  28. if (wage == -1)
  29. return;
  30. printf("Enter hours worked: ");
  31. scanf_s("%f", &hours);
  32. if (hours == -1)
  33. return;
  34.  
  35. //calculations
  36. if (hours > 40){
  37. OTpay = (hours-40) * (wage*1.5);
  38. basepay = (40) * (wage);
  39. grosspay = (basepay + OTpay);
  40. }
  41. if (hours < 40){
  42. OTpay = (0);
  43. basepay = (wage*hours);
  44. grosspay = (basepay);
  45. }
  46. tax = (grosspay*.20);
  47. netpay = (grosspay - tax);
  48. //output
  49. printf("\nPay to: %s\n", name);
  50. printf("Hours worked: %.2f\n", hours);
  51. printf("Hourly rate: %.2f\n", wage);
  52. printf("Gross pay: %.2f\n", grosspay);
  53. printf("Base pay: %.2f\n", basepay);
  54. printf("Overtime pay: %.2f\n", OTpay);
  55. printf("Taxes paid: %.2f\n", tax);
  56. printf("Net pay: %.2f\n", netpay);
  57. printf("----------------------------\n");
  58. }
  59. system("Pause");
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement