Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a short MATLAB function. A university department provides two ways to obta

ID: 671899 • Letter: W

Question

Write a short MATLAB function.

A university department provides two ways to obtain a masters degree:

Complete a minimum of 30 graduate credit hours and write a thesis.

Complete a minimum of 36 graduate credit hours.

Write a function called hw2_can_graduate that accepts two input arguments associated to a student: hours, the number of credit hours completed , and thesis, which determines whether or not a thesis has been completed (0 for no and 1 for yes). The function determines whether or not the student can graduate with a masters degree. Return 1 if the student can graduate and 0 if not. You must include a nested if-statement.

Explanation / Answer

function d = hw2_can_graduate(ch,th)
if (ch>=36)
d=1
elseif (ch>=30) && (th==1)
d=1
else
d=0
end
end
if (hw2_can_graduate(36,0)==1)
fprintf('you have graduated congratsss!!!')
else
fprintf('Nope you need to study')
end
if (hw2_can_graduate(30,1)==1)
fprintf('you have graduated congratsss!!!')
else
fprintf('Nope you need to study')
end
  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote