daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Mar 22nd, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5.  
  6. double calcGrossPay(int hours, double rate)
  7. {
  8.     double grossPay = 0.0;
  9.     double overtimePay = 0.0;
  10.  
  11.     if (hours > 40) {
  12.         hours = hours - 40;
  13.         overtimePay = hours * (rate * 1.5);
  14.     }
  15.     grossPay = hours * rate + overtimePay;
  16.     return grossPay;
  17. }
  18.  
  19. double calcTotal(double current, double pay)
  20. {
  21.     double total = 0.0;
  22.     total = current + pay;
  23.     return total;
  24.  
  25. }
  26.  
  27. int main()
  28. {
  29.     int hours = 0;
  30.     double rate = 0.0;
  31.     double current = 0.0;
  32.     double totalGrossPay = 0.0;
  33.     double pay = 0.0;
  34.  
  35.     int STOP = -1;
  36.     while (STOP == -1)
  37.     {
  38.         cout << "Enter Total hours worked: ";
  39.         cin >> hours;
  40.         cout << "Enter rate of pay for this employee: $";
  41.         cin >> rate;
  42.         current = calcGrossPay(hours, rate);
  43.         cout << "This employee's gross pay is: $" << current << endl << "Enter 1 to continue, enter anything else to stop." << endl;
  44.     }
  45.  
  46.    
  47.  
  48.     totalGrossPay = calcTotal(current, pay);
  49.     cout << "The total gross pay of all employee's is : $" << totalGrossPay << endl;
  50.  
  51.  
  52.  
  53.     system("pause");
  54.     return 0;
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top