%Exercises
clear;
hours = [ 7.25 9.5 12.75 6.5 8.25 ];   % hours for the week
hourly = 7.53;
overtime = hourly * 1.5;
gross_pay = 0;
for i = 1 : length(hours)  % for each day
    
    % if hours worked is 8 or fewer, then use hourly pay rate
    if hours(i) <= 8
        gross_pay = gross_pay + hours(i) * hourly;
    
    % if hours worked is more than 8, need to also compute overtime pay
    else
        gross_pay = gross_pay + 8*hourly + (hours(i) - 8)*overtime;
    end
end
disp(['Weekly gross pay is $', num2str(gross_pay)])

%Exercise 2
H = 4;
L = 7;
for r = 1 : H
    stars = [ ];
    for c = 1 : L
        stars = [stars  '*'];
    end
    disp(stars);
end

%Exercise 3
L = 4;
for r = 1 : L
    stars = [];
    for n = 1 : r
        stars = [stars '*'];
    end
    disp(stars);
end

%Exercise 4
H = 4;
L = 7;
for r = 1 : H
    stars = [];
    for c = 1 : L
        if r==1 | r==H | c==1 | c==L
            stars = [stars  '*'];
        else
            stars = [stars  ' '];
        end
    end
    disp(stars);
end