Question: Can somebody help me make this work? its producing a zero for the totals and I am not sure why. Its in C++ #include using

Can somebody help me make this work? its producing a zero for the totals and I am not sure why. Its in C++

#include using namespace std;

void getOvertime(int hours, double rate, double overtime, double doubleTime, double total) { if (hours > 37 && hours <= 50) { overtime = ((rate*1.5)*(hours)); total = (hours*rate) + overtime; } else if (hours > 50) { doubleTime = ((rate * 2)*(hours)); total = (hours*rate) + overtime + doubleTime; } else total = hours * rate; }

int main() { int hours; double rate; double overtime = 0.0; double doubleTime = 0.0; double total = 0.0; cout << "how many hours? "; cin >> hours; cout << "What is the rate of pay? "; cin >> rate; getOvertime(hours, rate, overtime, doubleTime, total); cout << "total :" << total << endl; system("pause"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!