Exercise 1 * IN MATLAB Microsoft has hired you as its employee. Below is the tab
ID: 3593518 • Letter: E
Question
Exercise 1 * IN MATLAB Microsoft has hired you as its employee. Below is the table of what you will make. Please create a program that will generate how much you will make when entering a particular number of hours. Microsoft expects you to work a lot of hours throughout the week! Hours Wages 41 Hours per week 25 dollars an hour 60 hours a week 25 dollars an hour plus 1.SX original pay for every hour after 41 25 dollars an hour plus 2X original pay for every hour after 41 70 Hours a week 100 Hours a week 25 dollars an hour plus 2X original pay for every hour after 41, plus a bonus of 2 weeks regular pay (41 hours per week)Explanation / Answer
PLEASE REFER BELOW CODE
close all
clear all
clc
hrs = input('Enter number of hours : '); %taking user input
salary = 0;
if hrs <= 41 %41 hrs per week
salary = hrs * 25;
elseif hrs > 41 && hrs <= 60 %60 hrs per weel
salary = (41 * 25) + ((hrs - 41) * 1.5 * 25);
elseif hrs > 60 && hrs <= 70 %70 hrs per week
salary = (41 * 25) + (2 * (hrs -41) * 25);
elseif hrs > 70 && hrs <= 100 % 100 hrs per week
salary = (41 * 25) + ( (hrs - 41) * 2 * 25) + (2 * 41 *25);
else
fprintf("Invalid input ");
end
%displaying output
fprintf("employee made %f $ amount ", salary);
PLEASE REFER BELOW OUTPUT
Enter number of hours : 89
employee made 5475.000000 $ amount
>>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.