3 having problem with number 3 2 Problem 2 I have a class wi

3) having problem with number 3?

2) Problem #2: I have a class with 5 students. We have had 7 quizzes so far. The max score on a Quiz is 30 points. The following table shows the current quiz scores: Student 1 -30 30 15 25 20 30 30 Student 2 - 20 10 25 25 30 23 30 Student 3-30 30 30 30 25 30 25 Student 4 -30 15 30 20 30 25 20 Student 5- 20 20 30 30 30 30 15 Create a 2D Array to store these scores. Then using loops to process through the data and figure out what their current grade is. (ie 90% or better-A, etc) 3) Problem #3: Extra Credit(10 Points extra): Change #2 above. This time, when you process the scores, allow the students to drop their lowest quiz score.

Solution

Matalb Code:

stuscores = [30 30 15 25 20 30 30;20 10 25 25 30 25 30;30 30 30 30 25 30 25;30 15 30 20 30 25 20;20 20 30 30 30 30 15];%taking elements in 2D array
for i=1:5
temp = stuscores(i,:);%taking each student row
minoftemp = min(temp);%taking the minimum score of each student
sum1 = 0;
cnt = 0;
for j=1:7
if temp(j)~=minoftemp%condtion to satisfy the score which is not equal to minimum value of score
sum1 = sum1+temp(j);
cnt = cnt+1;
end
percentageoftemp(i) = sum1/(cnt*30);%calculating percentage for each student
end
end
%calculating the grade
for i=1:5
if percentageoftemp(i)>=0.9
gradeofstu(i)=\'A\';
elseif percentageoftemp(i)>=0.8
gradeofstu(i)=\'B\';
elseif percentageoftemp(i)>=0.7
gradeofstu(i)=\'C\';
elseif percentageoftemp(i)>=0.6
gradeofstu(i)=\'D\';
elseif percentageoftemp(i)>=0.5
gradeofstu(i)=\'P\';
else
gradeofstu(i)=\'F\';
end
  
end
disp(gradeofstu);

Output:

ABABB

 3) having problem with number 3? 2) Problem #2: I have a class with 5 students. We have had 7 quizzes so far. The max score on a Quiz is 30 points. The followi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site