My code isn't working and my error list won't display so if someone could help me and tell me what is wrong and help me fix it that would be great!!
Prompt:
In this exercise, you create a program that calculates and displays gross pay amounts. The user will enter the number of hours an employee worked and his or her pay rate. The program should contain four value-returning functions: main, getHoursWorked, getPayRate, and calcGross. The main function should call each of the other three functions and then display the gross pay on the screen. When coding the calcGross function, you do not have to worry about overtime pay. You can assume that everyone works 40 or fewer hours per week. The hours worked and rate of pay may contain a decimal place. Use a sentinel value to end the program.
Code:
#include <iostream>
#include <iomanip>
using namespace std;
#include <iostream>
#include <iomanip>
usingnamespace std;
double getHoursWorked();
double getPayRate();
double calcGross();
int main()
{
//declare variables
double hoursWorked = 0;
double payRate = 0;
double grossPay = 0;
//enter input
hoursWorked = getHoursWorked();
payRate = getPayRate();
grossPay = calcGross();
//display the total points and grade
cout << "Gross Pay: " << grossPay << endl;
system("pause");
return 0;
} //end of main function
double getHoursWorked()
{
double hoursOfWork;
while (hoursOfWork != 0)
{
cout << "Please enter hours worked (enter 0 to stop): ";
cin >> hoursOfWork;
}
return hoursOfWork;
}//end of getHoursWorked function
double getPayRate()
{
double rateOfPay;
while (rateOfPay != 0)
{
cout << "Please enter pay rate (enter 0 to stop): ";
cin >> rateOfPay;
}
return rateOfPay;
}//end of getPayRate function
double calcGross(double workHours, double thePayRate)
{
double calculatedGross = 0.0;
calculatedGross = workHours * thePayRate;
return calculatedGross;
} //end of calcAverage function
You did not pass parameter when you call calcGross at line 21. Moreover, your forward declaration of function calcGross() at line 7 is not the same as your calcGross() function definition at line 56 that's why no compile errors found at main() when calling calcGross with no parameters.