Question: use Rstudio 3. Write a function to compute an employee's weekly pay (computeveeklyPay). The function should have two input arguments: hourly wage and hours worked.
use Rstudio
3. Write a function to compute an employee's weekly pay (computeveeklyPay). The function should have two input arguments: hourly wage and hours worked. The function should have one output argument: weekly pay, following rules calculated based on the i If the employee works less than or equal to 40 hours, the employee eams weekly pay based on hours worked times the hourly wage Ifthe employee works more than 40 hours and less than or equal to 60 hours, the employee earms double the hourly wage for the hours worked beyond 40 plus the 40 hours times the normal hourly wage Ifthe employee works more than 60 hours, the employee earns at triple the hourly wage for hours worked beyond 60, double for the 20 hours worked between 40 and 60, and the regular wage for the first 40 hours ii. iii. Include your function, which should use an if - else if - else control structure. Test the function for the following inputs and hourly pay $25.25 a. 38 hours worked, total pay- b. 47 hours worked, total pay - c, 63 hours worked, total pay- 3. Write a function to compute an employee's weekly pay (computeveeklyPay). The function should have two input arguments: hourly wage and hours worked. The function should have one output argument: weekly pay, following rules calculated based on the i If the employee works less than or equal to 40 hours, the employee eams weekly pay based on hours worked times the hourly wage Ifthe employee works more than 40 hours and less than or equal to 60 hours, the employee earms double the hourly wage for the hours worked beyond 40 plus the 40 hours times the normal hourly wage Ifthe employee works more than 60 hours, the employee earns at triple the hourly wage for hours worked beyond 60, double for the 20 hours worked between 40 and 60, and the regular wage for the first 40 hours ii. iii. Include your function, which should use an if - else if - else control structure. Test the function for the following inputs and hourly pay $25.25 a. 38 hours worked, total pay- b. 47 hours worked, total pay - c, 63 hours worked, total pay
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
