MATLAB code Exercise 1 (25 pts) In this problem, you will be writing a MATLAB sc
ID: 3744272 • Letter: M
Question
MATLAB code
Exercise 1 (25 pts) In this problem, you will be writing a MATLAB script that will compute and display a student's grade in a course. The student (user) will have to input their grades for Test 1, Test 2, and the Final Exam. The program computes the course average assuming Test 1 and Test 2 each count 30% and the Final Exam counts 40%. The program should roundthe course average to the nearest integer using round. The program will output the statement Your Course Average is: followed by the rounded course average. The program will then output the statement Your Course Grade Is: followed by the course grade. Assume the following grading scale: 2 90 80-89 70-79 60-69Explanation / Answer
test1 = input('Enter score of Test 1: ');
test2 = input('Enter score of Test 2: ');
final = input('Enter score of Final Exam: ');
average = test1*0.3 + test2*0.3 + final*0.4;
fprintf('Your Course Average is: %d ', round(average))
if average >= 90
grade = 'A';
elseif average >= 80
grade = 'B';
elseif average >= 80
grade = 'C';
elseif average >= 80
grade = 'D';
else
grade = 'F';
end
fprintf('Your Course Grade is: %s ', grade)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.