0

What kind of function do I need to used to change an employee's salary when given the old salary of the employee and the amount of increase for that employee (parameters).

(i.e. function with no return value and no parameter, function with no return value and call-by-value parameters, function with no return value and both call-by-value and call-by-reference parameters, or a function with return value and parameters, etc.

Thank you Much

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by VernonDozier
0

Well, think about it. It says "when given the old salary of the employee and the amount of increase for that employee (parameters)". Half of the problem is already done for you.

0

The function is going to take two parameters regardless of whether you pass by reference or by value. Regardless of whether you pass the salary by reference or value, I would pass the increase by value since you shouldn't change it. I would return a double if it was passed by value, and have it return a void if passed by reference:

void   IncreaseSalary (double& salary, double raise)   // by reference
double IncreaseSalary (double oldSalary, double raise)  // by value
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.