Matlab: As the user to input 4 quiz grades and 2 test grades. Calculate the final and letter grade when quizzes are worth 50% of the grade and each test is worth 25% of the grade. Display the final grade to the tenth along with the letter grade.
//This is the code in MATLAB.
function [G,L]=final_grade(Q1,Q2,Q3,Q4,T1,T2) //Here G is the Final grade and L is the Letter for the Grade.
Quiz_score=(Q1+Q2+Q3+Q4)/4; // Q1,Q2,Q3,Q4 are the user Quiz Grades and T1,T2 are the test scores.
Quiz_Percentage=Quiz_score*(50/100);
Test1_Percentage=T1*(25/100);
Test2_Percentage=T2*(25/100);
G=Quiz_Percentage+Test1_Percentage+Test2_Percentage; // final grade percentage
if(G>=90 && G<=100)
{ L='A' ; }
elseif(G>=80 && G<90)
{ L='B' ; }
elseif(G>=70 && G<80)
{ L='C' ; }
elseif(G>=60 && G<70)
{ L='D' ; }
elseif(G>=50 && G<60)
{ L='E' ; }
else
{ L='F' ; }
Get Answers For Free
Most questions answered within 1 hours.