Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having trouble getting this program to work. I need to calculate employee p

ID: 3863459 • Letter: I

Question

I am having trouble getting this program to work. I need to calculate employee pay based on hours over 37 as overtime(1,5) and hours over 50 as double time(2). I need to use a void function to calculate the pay. I believe I am really close but I keep getting errors. can you show me where Im going wrong. it keeps saying "redefinition of formal parameter 'overtime' and 'doubletime'. thanks. Oh yes it needs to be in c++

#include
#include

using namespace std;

void getOvertime(double overtime, double doubleTime) {
   int hours;
   double total;
   double rate;

   double overtime = 0.0;
   double doubleTime = 0.0;

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

   cout << "how many hours? ";
   cin >> hours;
   cout << "What is the rate of pay? ";
   cin >> rate;
   getOvertime(overtime, doubleTime);
   system("pause");
   return 0;
}

Explanation / Answer

#include <iostream>
using namespace std;

//Please commant if you need any correction in calculation
void getOvertime(int hours , double rate , double* regularTime ,double* overtime, double* doubleTime,double* total) {
  
    int regularH =0;
    int overTimeH =0;
    int doubleTimeH =0;
    if(hours<=37){
        regularH =hours;
        overTimeH =0;
        doubleTimeH =0;
    }
    else if(hours>37 && hours <= 50){
        regularH =37;
        overTimeH =hours-37;
        doubleTimeH =0;
    }
    else if(hours > 50){
        regularH =37;
        overTimeH =50-37;
        doubleTimeH =hours-50;
    }
    *regularTime = regularH * rate;
    *overtime = overTimeH * 1.5d;
    *doubleTime = doubleTimeH*2.0d;
    *total = *regularTime + *overtime +*doubleTime;
}

int main()
{
   int hours;
   double rate;
   double regularTime;
   double overtime;
   double doubleTime;
    double total;
   cout << "how many hours? ";
   cin >> hours;
   cout << "What is the rate of pay? ";
   cin >> rate;
   getOvertime(hours,rate,&regularTime,&overtime, &doubleTime,&total);
   cout << " Regular Time : " <<regularTime <<endl;
   cout << "Over Time : " <<overtime <<endl;
   cout << "Double Time : " <<doubleTime <<endl;
   cout << "Total Pay : " <<total <<endl;
// system("pause");
   return 0;
}