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

Grading Suppose a professor computes a student\'s final grade in the following m

ID: 3108757 • Letter: G

Question

Grading Suppose a professor computes a student's final grade in the following manner: There are three exams; the third counts for half of the final grade. Provided the student achieves a score of at least 60% on one of the first two exams, the lesser of the first two exam scores may be dropped, and the other counts for half of the final grade. If the student does not score at least 60% on either of the first two exams, each of them counts for a quarter of the final grade. Suppose you have an n times 3 matrix of students' exam scores Each row represents a student, and the columns are the students' scores on exams 1, 2 and 3, in that order on a scale of 0-100. Write a MATLAB function to take this matrix of exam scores and produce an n times 1 column vector of the students' final grades.

Explanation / Answer

matlab code is given below

function [] = stu_grad (st_m )
[m n]=size(st_m);
for i=1:m
if (st_m(i,1)>=60 || st_m(i,2)>=60)
final_grade(i)=(max([st_m(i,1) st_m(i,2)])+st_m(i,3))/2;
else
final_grade(i)= (st_m(i,1)+st_m(i,2))/4+st_m(i,3)/2;
end
end
display ('Final grade of student is ');
final_grade

%%% main programm %%%

clc;
clear all;
close all;

a=[40 30 50; 60 28 59; 45 60 70; 48 80 80 ; 80 80 80 ];
stu_grad(a)

output:

Final grade of student is

final_grade =

42.5000 59.5000 65.0000 80.0000 80.0000