## Calculating weekly wages often involves overtime pay computed at a rate different from the regular pay.

Questions: 1. (8 points) Calculating weekly wages often involves overtime pay computed at a rate different from the regular pay. (1) Write a user-defined MATLAB function (named GrossPay) that takes one single valued input argument, representing hours worked, and returns the gross pay according to the following algorithm: rate = 22.50; if hours > 40 gross_pay = rate * 40 + 1.5 * rate * (hours – 40) else gross_pay = rate * hours end (2) Write a MATLAB script file that asks for the number of hours worked and calls the GrossPay function to compute the gross pay. GrossPay should not print anything to the screen. The script should then print gross pay to the screen. You should verify the correctness of your program by using input hours: 20, 40, 49.5. The input/output of the script for input 20 should look like: Number of hours worked last week? 20 Hours Worked: 20.0, Gross Pay: \$450.00 What to submit for this question: Please submit a plain text file (named a4q1.txt) that contains the contents of both the function file (GrossPay.m) and the script file. Note that, to run the program, you need to have two separate files. But to submit them, you need to combine them (by copy and paste) into the a4q1.txt file to save paper when the TA prints them out. Do not include any output. 2. (8 points) The periodic payment amount A (or amortization) of a loan P can be calculated according to the following formula: