// file: PayrollFunctions.cpp
// Computes and displays gross pay and net pay given an hourly
// rate and number of hours worked. Deducts union deus of $15
// if gross salary exceeds $100; otherwise,deducts no dues.

#include <iostream>
using namespace std;

// Functions used...
void instructUser();
float computeGross (float, float);
float computeNet (money);

const float MAX_NO_DUES = 100.00;
const float dues = 15.00;
const float MAX_NO_OVERTIME = 40.0;
const float OVERTIME_RATE = 1.5;

int main()
{
    float hours;
    float rate;
    float gross;
    float net;
    
    
    // Display user instructions
    instructUser();
    
    //Enter hours and rate
    cout<< "hours worked: ";
    cin>> hours;
    cout<< " Hourly rate: $";
    cin>>rate;
    
    // Compute gorss salary 
    gross = computeGross (hours,rate );
    
    // Compute net salary
    net = computeNet(gross);
    
    // Print gross and net.
    cout << " Gross salary is $" << gross<<endl;
    cout<< "net salary is $<, net<<endl;
    
    return 0;
}

// Display user instructions 
void instructUser()

{ 
     cout << "This program compute gross and net salary . " << endl;
     cout<< " A dues amount of "<< Dues<, "is deducted for"<, endl;
     cout << " an employee who earns more than " << MAX_NO_DUES << endl<<endl;
     cout << " Overtime is paid at the rate of " << OVERTIME_RATE << endl;
     cout<< "times the regualr rate fro hours worked over "<< MAX_NO_OVERTIME endl << endl;
     cout << "on separate lines after the promts. " <<endl;
     cout << " Press <return > after typing each number . " << endl << endl; 
     }
     
     // Find the gross pay
     
     float compueGross
       (float hours,float rate)
       
       {
              
              // Local data . . .
              float gross;       // result : gross pay (dollars)
              float regularPay;  // pay for first 40 hours 
              float overtimePay;  // pay for hours in excess of 40
              
              // Compute gross pay.
              if ( hours > MAX_NO_OVERTIME)
              {
                   regularPay= MAX_NO_OVERTIME *rate;
                   overtimePay = (hours - MAX_NO_OVERTIME) * OVERTIME_RATE *rate;
                   fross = regularPay +overtimeay;
                   
                   else 
                   gross = hours * rate;
                   
                   return gross;
                   } // end computeGross
                   
              // Find the net pay
              
              float computeNet
              
              (float gross)
              
              {
                     
                     //Local data...
                     float net;
                     
                     // Compute net pay.
                     duesif (gross> MAX_NO_DUES)
                              net =gross - DUES // deduct dues amount
                              else 
                              net = gross;
                              
                              return net;
                              }//end computeNet

I don't know why when I compile the program, it has the error in the " money ", this program I copied from text book to practice, so I am confused now,
Please explain me more about the function and argument,... thank you

Well in your function declaration float computeNet (money); money is not a recognized datattype. Its probably your variable name.

You probably want float computeNet (float money);

// file: PayrollFunctions.cpp
// Computes and displays gross pay and net pay given an hourly
// rate and number of hours worked. Deducts union deus of $15
// if gross salary exceeds $100; otherwise,deducts no dues.

#include <iostream>
using namespace std;

// Functions used...
void instructUser();
float computeGross (float, float);
float computeNet (float money);

const float MAX_NO_DUES = 100.00;
const float dues = 15.00;
const float MAX_NO_OVERTIME = 40.0;
const float OVERTIME_RATE = 1.5;

int main()
{
    float hours;
    float rate;
    float gross;
    float net;
    
    
    // Display user instructions
    instructUser();
    
    //Enter hours and rate
    cout<< "hours worked: ";
    cin>> hours;
    cout<< " Hourly rate: $";
    cin>>rate;
    
    // Compute gorss salary 
    gross = computeGross (hours,rate );
    
    // Compute net salary
    net = computeNet(gross);
    
    // Print gross and net.
    cout << " Gross salary is $" << gross<<endl;
    cout<< " net salary is $ " << net << endl;
    
    return 0;
}

// Display user instructions 
void instructUser()

{ 
     cout << "This program compute gross and net salary . " << endl;
     cout << " A dues amount of " << dues << "is deducted for"<< endl;
     cout << " an employee who earns more than " << MAX_NO_DUES << endl<<endl;
     cout << " Overtime is paid at the rate of " << OVERTIME_RATE << endl;
     cout<< "times the regualr rate fro hours worked over "<< MAX_NO_OVERTIME <<endl << endl;
     cout << "on separate lines after the promts. " <<endl;
     cout << " Press <return > after typing each number . " << endl << endl; 
     }
     
     // Find the gross pay
     
     float compueGross
       (float hours,float rate)
       
       {
              
              // Local data . . .
              float gross;       // result : gross pay (dollars)
              float regularPay;  // pay for first 40 hours 
              float overtimePay;  // pay for hours in excess of 40
              
              // Compute gross pay.
              if ( hours > MAX_NO_OVERTIME)
              {
                   regularPay= MAX_NO_OVERTIME *rate;
                   overtimePay = (hours - MAX_NO_OVERTIME) * OVERTIME_RATE *rate;
                   gross = regularPay + overtimePay;
                   }
                   
                   else 
                   gross = hours * rate;
                   
                   return gross;
                   } // end computeGross
                   
              // Find the net pay
              
              float computeNet
              
              (float gross)
              
              {
                     
                     //Local data...
                     float net;
                     
                     // Compute net pay.
                     if ( gross > MAX_NO_DUES)
                              net = gross - dues ; // deduct dues amount
                              
                              else 
                              net = gross;
                              
                              return net;
                              }//end computeNet

Thanks for answering me, this is what I have done, when I compiled the program, it said that it done with error. And the program can not run

What is the exact error?

Also it is better to use int main(int argc , char *argv) ;
Copying code from text book does not compile most of the time since the author leaves you to complete the program.

Just a minor correction to Shark's post

int main(int argc, char *argv[]){

  return 0;
}

Its char *argv[] or char** argv[];

You need to post your compile errors, and read your code carefully !! There are mistakes like

float compueGross
       (float hours,float rate)
       
       {

I don't see a function called "compueGross" anywhere, do you ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.