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

Write a simple program called Prob5.m , which will prompt the user to input test

ID: 1993531 • Letter: W

Question

Write a simple program called Prob5.m, which will prompt the user to input test scores for a class. Your program should compute the letter grades using the following rules: score > 80 => A, 65-80 => B, 50-65=> C, 40-50 => D, and <40 => F. Your program should also compute the number of A, B, C, D, and F grades in the class. You may use the following data set to debug your program: [62 75 81 54 36 47 74 62 57 95]. Save your program under the name ‘Prob5.m’

Please solve using MATLAB

Explanation / Answer

MATLAB CODE:

clc;

clear all;

close all;

prompt ='Enter Test Score : ';

score= input(prompt);

for i=1:length(score)

if(score(i)>80)

Grade(i)='A';

elseif(score(i)>65 && score(i)<=80)

Grade(i)='B';

elseif(score(i)>50 && score(i)<=65)

Grade(i)='C';

elseif(score(i)>40 && score(i)<=50)

Grade(i)='D';

else

Grade(i)='F';

end

end

fprintf(' Score Grade ');

for i=1:length(score)

fprintf(' %d %c ',score(i),Grade(i));

end

OUPUT:

Enter Test Score : [62 75 81 54 36 47 74 62 57 95]

   Score        Grade
   62       C
   75       B
   81       A
   54       C
   36       F
   47       D
   74       B
   62       C
   57       C
   95       A

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