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

USE MATLAB the lab marks total to (/100) therefore there are 10 labs (contributi

ID: 3807877 • Letter: U

Question

USE MATLAB

the lab marks total to (/100) therefore there are 10 labs (contributing 20%), and the assignment is (/10) contributing 10%, and the exam is (/100) contributing 70%

A. write a function that accepts a student's laboratory, assignment and exam marks as inputs to determine the final mark to the nearest integer and the letter grade of the student. Your function header would be similar to: function [final mark, grade] markscalc(lab, assignment, exam) Note: The letter grades should be stored as a string' and are described as follows: final mark 280 HD 70 s final mark 80 D 60 s final mark 70 C 50 s final mark 60 final mark 50

Explanation / Answer

function [finalmark,grade] = markscalc(lab,assignment,exam)


labpercentage=(lab/100)*100;
assignmentpercentage=(assignment/10)*100;
exampercentage=(exam/100)*100;

finalmark=((labpercentage/100)*20)+((assignmentpercentage/100)*10)+((exampercentage/100)*70);

if(finalmark>=80)
grade="HD";
elseif( 70<=finalmark&&finalmark<80)
grade="D";
elseif 60<=finalmark&&finalmark<70
grade="C";
elseif 50<=finalmark&&finalmark<60
grade="P";

elseif finalmark<50
grade="F";

else
fprintf('Invalid finalmark ' );
end
end   

%call in this fashio:
%[finalmark,grade]=markscalc(50,5,50);
%finalmark
%grade