Currently we have a method that calculates a daily wage based on the Employee that calls it because the method uses fields inside the Employee class.
The boss, however, wants to be able to calculate daily wages based on information available only to him. What we can do is refactor the method to require new information to do that calculation. We will define two parameters: one for the hours worked and one for the hourly wage.
Now we don't want the calculation to be based on the current instance of the Employee but rather the values passed in so we need to change the references to target the parameters rather than the fields.
This will cause an error in the MainWindow because the call to CalculateWage does not provide any arguments when it should provide arguments for a decimal value and a double value.
To see what kind of arguments are needed for a method call, click inside the parenthesis and hit CTRL+SHFT+SPACE and it will pop up a box that indicates what is needed.
So let's insert some arguments.
Now when we run the application and step into the CalculateWage method we can see that the wage parameter is 12.50 and the hoursWorked parameter is 7.5.
If we step through the rest of the method we can see that the method will return 94 like it is supposed to.
The CalculateWage method is a little more reusable now. When the Employee wants to calculate their daily wage we can do so by inputting their field values into the call to CalculateWage.
So when we step through the CalculateWage method from the Employee's method call it will still function as intended.
An important thing to note about multiple parameters is that the order matters. For example, if we switch the two values we pass in to CalculateWage we will get an error.