MATLAB *Please write a Matlab friendly answer so i can input on my computer Writ
ID: 1716073 • Letter: M
Question
MATLAB
*Please write a Matlab friendly answer so i can input on my computer
Write a function called classAverage that takes in an array of numbers and, after normalizing the grades in such a way that the highest corresponds to 100, returns the letter grade of the class average. The grade ranges are as follows:
Average>90 => A
80<=average<90 B
70<=average<80 C
60<=average<70 D
average<60 F
For example:
classAverage( [70 87 95 80 80 78 85 90 66 89 89 100] ) should return B
classAverage( [50 90 61 82 75 92 81 76 87 41 98 31] ) should return C
classAverage( [10 17 55 60 50 38 25 40 36 19 39 10] ) should return F
Explanation / Answer
MATLAB code:
clear all
close all
clc
x=input('Enter nummbers in array : ');
y= mean(x);
if y >90
disp('A')
elseif y>80 && y<90
disp('B')
elseif y>70 && y<80
disp('c')
elseif y>60 && y<70
disp('D')
elseif y<60
disp('F')
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.