### total gross correct??

Here the code:
 ``12345678910111213141516171819202122232425262728293031323334353637383940414243`` `````` void grosspay(double &hours, double &payrate, double &gross_pay); double tgp(int time, double rate, double gp); int main() { int employees; int n, x, u; double y = 0.00; double tgrosspay = 0.00; double tgross = 0.00; //uble gpay = 0.00; int workers; double amount = 0.00; double pay_percentage = 0.00; double pay_g = 0.00; cout << "\t\t Welcome to the Gerston Blankets payroll!"; cout << endl << endl << endl; cout << "Press -1 to end. "; cin >> u; cout << endl << endl; cout << "Enter the number of employees: "; cin >> employees; cout << endl << endl; for(x=0; x<=employees-1; x++) { grosspay(amount, pay_percentage, pay_g); tgrosspay = tgp(amount, pay_percentage, pay_g); y = y + tgrosspay; } cout << fixed << setprecision(2); cout << "Total gross pay is: \$" << y; cout << endl; } ``````

I don't know if where i have mistakes
Thank and i acknowlege
Last edited on
Well your program is compiling, it looks like it works.
What else do you want? If you have questions post them here.
the total gross pay is wrong if i enter this

Enter hours worked for employee: 45

Enter pay rate for employee:15
total gross is :75937

the total gross pay is wrong
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105`` ``````#include #include using namespace std; void grosspay(double &hours, double &payrate, double &gross_pay); double tgp(double time, double rate, double gp); int main() { int employees; int n, x, u; double y = 0.00; double tgrosspay = 0.00; double tgross = 0.00; //uble gpay = 0.00; int workers; double amount = 0.00; double pay_percentage = 0.00; double pay_g = 0.00; cout << "\t\t Welcome to the Gerston Blankets payroll!"; cout << endl << endl << endl; cout << "Press -1 to end. "; cin >> u; cout << endl << endl; cout << "Enter the number of employees: "; cin >> employees; cout << endl << endl; for(x=0; x<=employees-1; x++) { grosspay(amount, pay_percentage, pay_g); tgrosspay = tgp(amount, pay_percentage, pay_g); y = y + tgrosspay; } cout << fixed << setprecision(2); cout << "Total gross pay is: \$" << y; cout << endl; if(u == -1) { cout << "This program will end." << endl << endl; } system("pause"); } void grosspay(double &hours, double &payrate, double &gross_pay) { //double gross_pay; //int x; //double hours; //double payrate; //double payra = 15.00; //int employees; char dollar='\$'; double excess, qpay = 0,pmprate,total = 0 ; int min = 40; cout << endl << "Enter hours worked for employee: "; cin >> hours; cout << "Enter pay rate for employee: " << "\$"; cin >> payrate; if(hours > 40) { excess = hours - min; qpay = payrate/2; pmprate = excess * qpay; total = min * payrate; gross_pay = pmprate + total; } else { gross_pay = payrate * hours; } cout << fixed << setprecision(2); cout << "Gross pay for employee is: " << "\$" << gross_pay; cout << endl; } double tgp(double time, double rate, double gp) { double total_grosspay = 0.00; //double gross_pay; //int x, workers; double overtime = 15.00; if(time > 40) { rate = rate + (overtime/2); } gp = rate * time; total_grosspay = total_grosspay + gp; //cout << total_grosspay << endl; return total_grosspay;; }``````