Advertisement
Guest User

Untitled

a guest
Jan 24th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. // hagendNetPay.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. /* Program Name: NetPay.cpp
  5. Function: This program calculates employee net pay value. All employees have a standard $45 deduction from their checks.
  6. If an employee does not earn enough to cover the deduction, an error is displayed.
  7. */
  8.  
  9. #include <iostream>
  10. #include <string>
  11.  
  12. using namespace std;
  13.  
  14. int main()
  15. {
  16. // Declare variables
  17. string name;
  18. int hours;
  19. int DEDUCTION = 45;
  20. int gross;
  21. int net;
  22. int rate;
  23. string EOFNAME = "ZZZ";
  24.  
  25.  
  26.  
  27. // Declare input items
  28. cout << "first name or " << EOFNAME << " to quit ";
  29. cin >> name;
  30. if (name != EOFNAME)
  31. {
  32. cout << "Enter hours worked for " << name << endl;
  33. cin >> hours;
  34. cout << "Enter hourly rate for " << name << endl;
  35. cin >> rate;
  36. gross = hours * rate;
  37. net = gross - DEDUCTION;
  38.  
  39.  
  40.  
  41. }
  42. while (net > 0)
  43. {
  44. cout << "Net pay for " << name << " is " << net << endl;
  45.  
  46. }
  47. if (net < 0)
  48. {
  49. cout << "Deductions not covered. Net is 0.";
  50.  
  51. }
  52. {
  53. cout << "Enter next name or " << EOFNAME << " to quit ";
  54.  
  55. }
  56. return 0;
  57. } //end of main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement