lab2 ex1

lab2 ex1

You cannot submit for this problem because the homework's deadline is due.

Ex1. Letter grade calculator (15 marks)

Read a student's score (an integer) from user input and output the corresponding letter grade according to the SJTU conversion rules:

Score Letter grade
95-100 A+
90-94 A
85-89 A-
80-84 B+
75-79 B
70-74 B-
67-69 C+
65-66 C
62-64 C-
60-61 D
0-59 F

Hint 1: Why do we specify that the score will be an integer? Because we want you to use the switch statement instead of a lot of elseifs. Recall the method to match a variable against a group of values, which is covered in the lectures.

Hint 2: Use num2cell() to avoid typing all the numbers manually.

Sample test case

Input:

99

Output:

A+

Format

You should submit a compressed file containing a Matlab source file ex1.m

Lab2

Not Claimed
Status
Finished
Problems
6
Open Since
2023-05-23 18:00
DDL
2023-05-25 22:00
Extension
0.0 hour(s)