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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started