Question: The following array, grades , contains the grades (as percentages) for six students in one class. Each row corresponds to a student, with the first
The following array, grades, contains the grades (as percentages) for six students in one class. Each row corresponds to a student, with the first four columns corresponding to the four tests and the last column corresponding to the final exam.
grades = [45 60 68 78 83; 67 55 45 25 0; 88 78 87 67 65; 75 40 76 82 85; 20 56 78 79 67; 99 86 89 91 100]
The average of the four tests counts for 75% of the finals grade and the finals examination counts for 25% of the finals grade (FG). The actual letter grade is then determined from the following relationships:
| 93 FG 100 | A | 90 FG < 93 | A | ||
| 87 FG < 90 | B+ | 83 FG < 87 | B | 80 FG < 83 | B |
| 77 FG < 80 | C+ | 73 FG < 77 | C | 70 FG < 73 | C |
| 65 FG < 70 | D+ | 60 FG < 65 | D | FG < 60 | F |
Write a MATLAB program that provides and displays (in order) a character output of A, A, B+, B, B, C+, C, C, D+, D, or F for each of the students and then displays an ASCII version of these characters stored in the 6 by 2 matrix called ascgrades (unneeded elements in the array should be assigned a value of zero). When writing this program:
i) Instead of using 6 or 5 anywhere in this program, corresponding to the dimensions of the array, use the size( ) command in locations such as the iteration loop limits.
ii) Use two nested for( ) loops to scan through the matrix.
iii) Use one or more if( )-else statements (with relational expressions) when determining the letter grade. Alternatively, a switch-case statement may be used if desired.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
