Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. /***********************************************************************************/
  2. /* Lab.Assignment#3 */
  3. /* process the weekly payroll in a company of one or more employees */
  4. /* */
  5. /* Programmer: John Smith */
  6. /* Class CS 2400-01 */
  7. /* Due Date: October 12, 2017 */
  8. /***********************************************************************************/
  9.  
  10.  
  11.  
  12.  
  13. #include <iostream>
  14. #include <cstdlib>
  15. using namespace std;
  16.  
  17. #include "EmployeeInfo.h"
  18. #define DUMMYNUMBER -99
  19. int main()
  20. {
  21.  
  22. int hours = 0; //Holds the hours the people workded
  23. int hoursPlus= 0; //Holds the hours combined
  24. double netPay; //holds the netpay
  25. double tax; //holds the tax
  26. double grossPay = 0; //holds the grosspay
  27. double totalGrossPay = 0; //holds the total gross pay
  28. double totalTax = 0; // holds the total tax
  29. int count = 0; // holds the count for the while loop
  30. EmployeeInfo Employee; //Employee being computed
  31.  
  32. while(Employee.ID != DUMMYNUMBER){
  33.  
  34.  
  35.  
  36.  
  37. cin >> Employee.ID >> Employee.firstName >> Employee.lastName >> Employee.birthDate.day >> Employee.birthDate.month >> Employee.birthDate.year
  38. >> Employee.hiredDate.day >> Employee.hiredDate.month >> Employee.hiredDate.year >> Employee.payRate;
  39.  
  40. while(count <5){
  41. cin>> hours;
  42. hoursPlus+=hours;
  43. count++;
  44.  
  45. }
  46. grossPay = Employee.payRate * hoursPlus;
  47.  
  48. if(grossPay >= 1000)
  49. {
  50. tax = grossPay * .20;
  51.  
  52. }
  53. else if(grossPay >= 800)
  54. {
  55. tax = grossPay * .18;
  56.  
  57. }
  58. else if(grossPay >= 600)
  59. {
  60. tax = grossPay * .15;
  61.  
  62. }
  63. else
  64. {
  65. tax = grossPay * .10;
  66. }
  67.  
  68. netPay = grossPay - tax; //gets the net pay
  69. totalTax += tax; // gets the total tax
  70. totalGrossPay += grossPay; //gets the total grosspay
  71.  
  72.  
  73. cout << endl << Employee.lastName<<","<< Employee.firstName;
  74. cout << endl <<"ID:\t"<< Employee.ID;
  75. cout << endl << "DOB:\t"<<Employee.birthDate.day <<"/"<< Employee.birthDate.month<<"/"<< Employee.birthDate.year;
  76. cout << endl << "BOH:\t"<<Employee.hiredDate.day <<"/"<<Employee.hiredDate.month<<"/"<<Employee.hiredDate.year;
  77. cout << endl << "Hours:\t" << hoursPlus;
  78. cout << endl << "Pay Rate:\t$"<<Employee.payRate;
  79. cout << endl << "Gross Pay:\t$"<< grossPay;
  80. cout << endl << "Tax:\t$"<< tax;
  81. cout << endl << "Net Pay:\t$"<< netPay;
  82. cout << endl << " ";
  83. cout << endl << " ";
  84. hoursPlus = 0;
  85. count = 0;
  86. cin >> Employee.ID;
  87. }
  88. cout << endl << "the total tax deduction of the company is \t$"<< totalTax;
  89. cout << endl << "the total gross pay of the company is \t$"<< totalGrossPay;
  90.  
  91.  
  92. return EXIT_SUCCESS;
  93.  
  94.  
  95.  
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement