Question

MATLAB % The variable sv below has the scores of a class exam. % A for...

MATLAB

% The variable sv below has the scores of a class exam.
% A for a score >=90, then B for a score >= 80, then C for a score >=70,
% then D for a score >= 60, then F.
% 1) Use only one for loop to implement the following requirements:
% 2) Check each score and find its letter grader.
% 3) Compute the numbers of students who got A, B, C, D, or F
% 4) Compute the total number of students who passed the exam.
% 5) Compute the average score
% 6) Create a vector letterScore contains the converted letter grades.(Optional)
% Refer the lab4_test_output.txt file for more details on the requirements.
if (~exist('fileID'))
fileID = fopen('lab4_test_output.txt', 'w');
end
fprintf(fileID, '\n*****Q4: loop, score analysis:\n');
sv = [83, 95, 65, 55, 100, 66, 82, 87, 96, 89, 75, 93, ...
99, 82, 67, 88, 66, 57, 77, 92];
letterScore = [];
% Write your code here:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

sv = [83, 95, 65, 55, 100, 66, 82, 87, 96, 89, 75, 93,99, 82, 67, 88, 66, 57, 77, 92];
a=0
b=0
c=0
d=0
f=0
passed=0
avg=0
for i=1:1:length(sv)
  
avg=avg+sv(i) %for calculating average,first we will find sum

%checking the range and incrementing the appropriate grade
if sv(i)>=90
a=a+1
elseif sv(i)>=80
b=b+1
elseif sv(i)>=70
c=c+1
elseif sv(i)>=60
d=d+1
else
f=f+1
end
end

avg=avg/length(sv)

passed=a+b+c+d

%displaying the results
fprintf("The number of students who got A grade are %d\n\n",a)
fprintf("The number of students who got B grade are %d\n\n",b)
fprintf("The number of students who got C grade are %d\n\n",c)
fprintf("The number of students who got D grade are %d\n\n",d)
fprintf("The number of students who passed are %d\n\n",passed)
fprintf("The average score of students is %f\n",avg)

Output:

Add a comment
Know the answer?
Add Answer to:
MATLAB % The variable sv below has the scores of a class exam. % A for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Grades on a biology exam are approximately normally distributed with a mean of 78 and a...

    Grades on a biology exam are approximately normally distributed with a mean of 78 and a standard deviation of 8. Originally Dr. Smith decides to curve course grades as follows: Students who score above the 90 percentile will receive an A Students whose scores are in the 80-89.percentiles receive a B Students whose scores are in the 70th-795h percentiles receive a C Students whose scores are in the 60-69 percentiles receive a D Students who score below the 60th percentile...

  • In order to determine whether or not a motorcycle education course improves the scores on a...

    In order to determine whether or not a motorcycle education course improves the scores on a driving exam, a sample of 6 drivers were given the exam before and after taking the course. The results are shown below. Assume the population of differences is normally distributed. Let d = Score After - Score Before. Driver Score Before the Course Score After the Course 1 83 87 2 89 89 3 93 91 4 77 77 5 86 93 6 79...

  • use  JOptionPane to display output Can someone please help write a program in Java using loops, not...

    use  JOptionPane to display output Can someone please help write a program in Java using loops, not HashMap Test 1 Grades After the class complete the first exam, I saved all of the grades in a text file called test1.txt. Your job is to do some analysis on the grades for me. Input: There will not be any input for this program. This is called a batch program because there will be no user interaction other than to run the program....

  • Find the indicated measure. The test scores of 40 students are listed below. Find P85.

    Find the indicated measure. The test scores of 40 students are listed below. Find P85. 30 35 43 44 47 48 54 55 56 57 59 62 63 65 66 68 69 69 71 72 72 73 74 76 77 77 78 79 80 81 81 82 83 85 89 92 93 94 97 98  1) 85  2) 87 3) 89 4) 34

  • Find the indicated measure. The test scores of 40 students are listed below. Find P85. 30...

    Find the indicated measure. The test scores of 40 students are listed below. Find P85. 30 35 43 44 47 48 54 55 56 57 59 62 63 65 66 68 69 69 71 72 72 73 74 76 77 77 78 79 80 81 81 82 83 85 89 92 93 94 97 98 1) 85 2) 87 3) 89 4) 34

  • Student stress at final exam time comes partly from the uncertainty of grades and the consequence...

    Student stress at final exam time comes partly from the uncertainty of grades and the consequences of those grades. Can knowledge of a midterm grade be used to predict a final exam grade? A random sample of 200 BCOM students from recent years was taken and their percentage grades on assignments, midterm exam, and final exam were recorded. Let’s examine the ability of midterm and assignment grades to predict final exam grades. The data are shown here: Assignment Midterm FinalExam...

  • Consider the below matrixA, which you can copy and paste directly into Matlab.

    Problem #1: Consider the below matrix A, which you can copy and paste directly into Matlab. The matrix contains 3 columns. The first column consists of Test #1 marks, the second column is Test # 2 marks, and the third column is final exam marks for a large linear algebra course. Each row represents a particular student.A = [36 45 75 81 59 73 77 73 73 65 72 78 65 55 83 73 57 78 84 31 60 83...

  • The given data is the grades for people in this class. The goal here is to...

    The given data is the grades for people in this class. The goal here is to determine the factors that effect student's Grade in the class. 4) Find the mean and median for the men's and the women's Quizzes. Gender Men Women 5) Test the claim that the majority of students at this class are women. F M F F M F F F F M M F F F M F F F F M M F F M...

  • Write a java program to read a list of exam grades given as int's in the...

    Write a java program to read a list of exam grades given as int's in the range of 0 to 100. Your program will display the total number of grades and the number of grades in each letter-grade category as follows: A 93 <= grade <= 100 A- 90 <= grade < 93 B+ 87 <= grade < 90 B 83 <= grade < 87 B- 80 <= grade < 83 C+ 77 <= grade < 80 C 73 <=...

  • Use the Grouped Distribution method for the following exercise (see Self-Test 2-4 for detailed instructions), rounding...

    Use the Grouped Distribution method for the following exercise (see Self-Test 2-4 for detailed instructions), rounding each answer to the nearest whole number. Using the frequency distribution below (scores on a statistics exam taken by 80 students), determine:ion 1 of the preliminary test (scores on a statistics exam taken by 80 students), determine: 68 84 75 82 68 90 62 88 76 93 73 79 88 73 60 93 71 59 85 75 61 65 75 87 74 62 95...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT