Hi There I have a Code that I wrote to calculate Salaries for weekly and hourly paid employess. The Code works perfectly but the question said I should use a overload function called calcWeeklyPay

Could you give me a indication of What to do ?

This is The Working Code without the Overload Function
 ``12345678910111213141516171819202122232425262728293031323334353637383940`` ``````#include using namespace std; int main() { double paidWeekly, paidHourly , hoursWorked, annualSalary, hourlyWage; int employeeType; cout << "For Weekly paid employees Enter 0, For Hourly Paid Employees Enter 1: "; cin >> employeeType; if (employeeType==0) { cout << "Please Enter Your Annual Salary" << " of a Weekly Paid Employee: "; cin >> annualSalary; paidWeekly=annualSalary/52; cout<<"The Weekly Salary for this employee is: R"<> hourlyWage; cout<< "Enter Hours Worked: "; cin >> hoursWorked; paidHourly=hourlyWage*hoursWorked; cout<<"The Weekly Salary for this employee is:"<

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546`` ``````#include double calcWeeklyPay(double annualSalary); //Returns the Weekly salary of weekly paid Employees double calcWeeklyPay(double hourlyWage, double hoursWorked); //Returns the Weekly salary of Hourly paid Employees int main() { using namespace std; double annualSalary,hourlyWage,hoursWorked ,paidWeekly,paidHourly cout << "Please Enter Your Annual Salary" << "of a Weekly Paid Employee:"; cin >> annualSalary; paidWeekly = calcWeeklyPay(double annualSalary) cout<<"The Annual Salary for the weekly paid employee is:"<> hourlyWage; cout<< "Enter Hours Worked"; cin >> hoursWorked; paidHourly=calcWeeklyPay(double hourlyWage,double hoursWorked) cout<<"The Annual Salary for the hourly paid employee is:"<

Thanks
So define the other function, what part are you having trouble with?
Getting The Program To work, If I Run the second code I get 12 Errors
on line 19: `double annualSalary` is declaring a variable. For passing the variable to the function you need to remove the type (double). The same applies to line 30.

And a `;` is required at the end of line 19/30.

you need to implement the second function `double calcWeeklyPay(double hourlyWage, double hoursWorked)`
Topic archived. No new replies allowed.