Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double calcGrossPay(int hours, double rate)
- {
- double grossPay = 0.0;
- double overtimePay = 0.0;
- if (hours > 40) {
- hours = hours - 40;
- overtimePay = hours * (rate * 1.5);
- }
- grossPay = hours * rate + overtimePay;
- return grossPay;
- }
- double calcTotal(double current, double pay)
- {
- double total = 0.0;
- total = current + pay;
- return total;
- }
- int main()
- {
- int hours = 0;
- double rate = 0.0;
- double current = 0.0;
- double totalGrossPay = 0.0;
- double pay = 0.0;
- int STOP = -1;
- while (STOP == -1)
- {
- cout << "Enter Total hours worked: ";
- cin >> hours;
- cout << "Enter rate of pay for this employee: $";
- cin >> rate;
- current = calcGrossPay(hours, rate);
- cout << "This employee's gross pay is: $" << current << endl << "Enter 1 to continue, enter anything else to stop." << endl;
- }
- totalGrossPay = calcTotal(current, pay);
- cout << "The total gross pay of all employee's is : $" << totalGrossPay << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement