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

Problem 1. (If/elseif Branching) The grades of a student are given below: A=[11

ID: 2267667 • Letter: P

Question

Problem 1. (If/elseif Branching) The grades of a student are given below: A=[11 9 17 16 29 41 42 65 881 Homework is recorded in the first four entries, then next to are quizzes, the next two are midterms, and the final entry is the final. The association between the grades and the categories is: [HW, HW, HW, HW, quiz, quiz, midterm, midterm, final]. Create a code using if-else to check if there are any errors in the scores. a. If any homework score is greater than 10, display the message "Error in HW category, please fix HW scores" using disp(). b. If any quiz score is greater than 30, display the message "Error in quiz category, please fix quiz scores" using disp). c. If any midterm score is greater than 50, display the message "Error in midterm category, please fix midterm scores" using disp(). d. If final score is greater than 100, display the message "Error in final category, please fix final scores" using disp(

Explanation / Answer

Matlab Script:

A = [11 9 17 16 29 41 42 65 88];

HW = A(1:4);
quiz = A(5:6);
midterm = A(7:8);
final = A(end);

if sum(HW>10)>0 %gives 1 if any of HW is greater than 10
disp('Error in HW category, please fix HW scores');
end

if sum(quiz>30)>0
disp('Error in quiz category, please fix HW scores');
end

if sum(midterm>50)>0
disp('Error in midterm category, please fix HW scores');
end

if sum(final>100)>0
disp('Error in final category, please fix HW scores');
end

output:

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