function prototype

I am not sure what to put for display instructions and calculating the paycheck amount. Can anyone help me with this?

Q: this program asks the user to enter an employee's hourly rate and the number of hours worked, and calculates the amount of the employee's weekly paycheck.

please enter the number of hours that the employee worked (0 or greater): 25.5
Please enter the hourly wage for the employee (must be 0.00 or greater): 12.50

the employee's paycheck will be $318.75


// Preprocessor statements
#include <iostream>
#include <iomanip>
using namespace std;

// Function prototypes



// --------------- 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;
}
Last edited on
1. Please edit your post and use code tags <>. They're under the format section.
2. You didint ask a question, so I can not help you with anything.
the question is

Q: this program asks the user to enter an employee's hourly rate and the number of hours worked, and calculates the amount of the employee's weekly paycheck.

please enter the number of hours that the employee worked (0 or greater): 25.5
Please enter the hourly wage for the employee (must be 0.00 or greater): 12.50

the employee's paycheck will be $318.75
You've called a function calculatePaycheck but havent even made it. Once you make the function, the program should work fine.

displayInstructions is not even necessary.
Break it up into steps.

1) Your code currently doesn't compile. That's because the displayInstructions and calculatePaycheck functions are undefined. First, just try defining the displayInstructions function. Don't make it do anything first... just define the function so that part of the program will compile.
2) Do the same thing for the calculatePaycheck function. Again, it doesn't have to do anything yet. Just define it. After you do this, you should be able to compile and run your program.
3) Now make the displayInstructions actually do something. What does the program want the user to do? Cout instructions of that in this function.
4) Now make the calculatePaycheck function do something. How do you calculate a paycheck based on the hours worked and the hourly wage? Return that calculation.

At that point, you're done! If any step is too difficult, try to break it down further or look up information on how to define a function/take inputs/return outputs/etc.
Topic archived. No new replies allowed.