Skip to content

Commit 0c68123

Browse files
author
“A1-4U2T1NN”
committed
fix: rebuilt 'else-if' statements for converGpaToLetterGrade;
1 parent 18ecdcb commit 0c68123

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lesson_07/conditionals/src/lesson7.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,28 @@ export function compareStrings(a: string, b: string): number {
4848
*/
4949
export function convertGpaToLetterGrade(gpa: number): string {
5050

51-
if(gpa > 4.0){
51+
if (gpa >= 4.0) {
5252
return "A";
53-
}else if(gpa >= 3.7 && gpa < 4.0) {
54-
return "A-";
55-
}else if(gpa >= 3.3 && gpa < 3.7){
56-
return "B+";
57-
}else if(gpa >= 3.0 && gpa < 3.3){
58-
return "B";
59-
}else if(gpa >= 2.7 && gpa < 3){
60-
return "B-";
61-
}else if(gpa >= 2.3 && gpa < 3.7){
62-
return "C+";
63-
}else if(gpa >= 2.0 && gpa < 2.3){
53+
} else if (gpa >= 3.7) {
54+
return "A-";
55+
} else if (gpa >= 3.3) {
56+
return "B+";
57+
} else if (gpa >= 3.0) {
58+
return "B";
59+
} else if (gpa >= 2.7) {
60+
return "B-";
61+
} else if (gpa >= 2.3) {
62+
return "C+";
63+
} else if (gpa >= 2.0) {
6464
return "C";
65-
}else if(gpa >= 1.7 && gpa < 2){
65+
} else if (gpa >= 1.7) {
6666
return "C-";
67-
}else if(gpa >= 1.3 && gpa < 1.7){
67+
} else if (gpa >= 1.3) {
6868
return "D+";
69-
}else if(gpa >= 1.0 && gpa < 1.3){
69+
} else if (gpa >= 1.0) {
7070
return "D";
7171
}
72-
return "F";
72+
return "F";
7373
}
7474

7575
/**

0 commit comments

Comments
 (0)