switch statement
Triecie77 (0)

Create a property called testScore of type Int. Write a switch statement that will print out a grade based on the student's score.

Score Criteria
A+: 97%-100%
A: 93%-96%
A-: 90%-92%
B+: 87%-89%
B: 83%-86%
B-: 80%-82%
C+: 77%-79%
C: 73%-76%
C-: 70%-72%
D+: 67%-69%
D: 63%-66%
D: 60%-62%
F: 0%-59%
let testScore = 90...1

switch testScore {
case 0...59:
print("grade F")
case 60...69:
print("grade D && D+")
case 70...79:
print("grade C && C+")
case 80...89:
print("grade B && B+")
case 90...100:
print("grade A && A+")
default:
print("All student's testScore")
}

You are viewing a single comment. View All
Answered by theangryepicbanana (857) [earned 5 cycles]
View Answer