Skip to content

Commit 6e4e004

Browse files
committed
feat: adds Kimberlee's lesson_07 conditionals &
loops
1 parent b024553 commit 6e4e004

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

lesson_07/conditionals/src/lesson7.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { computeLexicographicDistance } from "./util.js";
1+
//import { computeLexicographicDistance } from "./util.js";
22

33
/** (Q1)
44
* Returns true if the provided age meets the minimum US voting age and false otherwise.
@@ -81,31 +81,29 @@ export function myGrade(grade: number): string {
8181

8282
export function convertGpaToLetterGrade(gpa: number): string {
8383
if (gpa >= 4.0) {
84-
return "A+";
85-
} else if (gpa > 3.7 && gpa < 4.0) {
8684
return "A";
87-
} else if (gpa > 3.3 && gpa <= 3.7) {
85+
} else if (gpa >= 3.7) {
8886
return "A-";
89-
} else if (gpa > 3.0 && gpa <= 3.3) {
87+
} else if (gpa >= 3.3) {
9088
return "B+";
91-
} else if (gpa > 2.7 && gpa <= 3.0) {
89+
} else if (gpa >= 3.0) {
9290
return "B";
93-
} else if (gpa > 2.3 && gpa <= 2.7) {
91+
} else if (gpa >= 2.7) {
9492
return "B-";
95-
} else if (gpa > 2.0 && gpa <= 2.3) {
93+
} else if (gpa >= 2.3) {
9694
return "C+";
97-
} else if (gpa > 1.7 && gpa <= 2.0) {
95+
} else if (gpa >= 2.0) {
9896
return "C";
99-
} else if (gpa > 1.3 && gpa <= 1.7) {
97+
} else if (gpa >= 1.7) {
10098
return "C-";
101-
} else if (gpa > 1.0 && gpa <= 1.3) {
99+
} else if (gpa >= 1.3) {
102100
return "D+";
103-
} else if (gpa > 0.0 && gpa <= 1.0) {
101+
} else if (gpa >= 1.0) {
104102
return "D";
105-
} else if (gpa < 0.0) {
103+
} else if (gpa < 1.0 && gpa >= 0) {
106104
return "F";
107105
} else {
108-
return "unable to assess";
106+
return "Invalid";
109107
}
110108
}
111109

0 commit comments

Comments
 (0)