Problems with Payroll Program

I can't figure out what I'm doing wrong with this program. I'm required to ask the user to input hourly rate and numbers of hours worked and it should calculate the weekly paycheck. I'm supposed to use void functions.

#include <iostream>
#include <iomanip>
using namespace std;

void displayInstructions ();
void calculatePaycheck (int, int);


// --------------- DO NOT EDIT, IN ANY WAY, THE CODE IN THE MAIN FUNCTION.
// Program starts here:
int main()
{

float hoursWorked, hourlyWage, paycheckAmount;

// Display the program information to the user.
displayInstructions();

do{
cout << "Please enter the number of hours that the employee worked (0 or greater): ";
cin >> hoursWorked;

if(hoursWorked < 0)
cout << "ERROR: Number of hours worked must be 0 or greater. Try again..." << endl << endl;

} while(hoursWorked < 0);

do{
cout << "Please enter the hourly wage for the employee (must be 0.00 or greater): ";
cin >> hourlyWage;

if(hourlyWage < 0.00)
cout << "ERROR: Hourly wage must be 0.00 or greater. Try again..." << endl << endl;

} while (hourlyWage < 0.00);

// Calculate the amount of the paycheck
paycheckAmount = calculatePaycheck(hoursWorked, hourlyWage);

// Display the results
cout << endl << endl;
cout << fixed << setprecision(2);
cout << "The employee's paycheck will be $" << paycheckAmount << "." << endl;


// End of program
return 0;
}

void displayInstructions()
{
cout << "Welcome to the paycheck calculation system. \n" ;

cout << "This program asks the user to enter an employee's hourly rate \n";
cout << "and the number of hours worked, and calculates the amount of \n ";
cout << "the employee's weekly paycheck. \n";
}

void calculatePaycheck(int num1, int num2)
{
cout << "The number is << num1 * num2 << " ;

}
You must have gotten the instructions wrong. If you are only allowed to use void functions, then this line:

paycheckAmount = calculatePaycheck(hoursWorked, hourlyWage);

is clearly wrong, because it expects calculatePaycheck to return a float.

By the way, use [code][/code] tags to post your code.
Topic archived. No new replies allowed.