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

Write a function file named “credit.m” which takes midterm, final, and homework

ID: 3588493 • Letter: W

Question

Write a function file named “credit.m” which takes midterm, final, and homework scores as input arguments and display credit A-F according to the following rules:
Total score: midterm 30 %, final 30 %, homework 40%. (Assume that the full scores of midterm, final, and homework are 100, 100, and 200, respectively.)

A: 90 total score 100 (The full score is 100 points) B: 80 total score < 90
C: 70 total score < 80
D: otherwise

If any of the e x a m results is below 5 (out of 100), the credit should be F regardless of other scores.

Explanation / Answer


function credit(midterm_score, final_score, homework_score)
%Check whether the scores are below 10, in which case, the credit would be 'F'.
if midterm_score < 10 | final_score < 10
disp("Credit: F")
return
end
  
%Calculate total score.
total_score = (midterm_score * 0.3) + (final_score * 0.3) + (homework_score * 0.4);
  
%Check the score and print out the corresponding grade.
if total_score >= 90
disp("Credit: A")
elseif total_score >= 80
disp("Credit: B")
elseif total_score >= 70
disp("Credit: C")
else
disp("Credit: D")
end
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