Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Grade.java added to the feature/grade branch
  • Loading branch information
nudar2107041 committed Aug 21, 2025
commit 7d4482a4d584033b56c92ed33bdee003c907aeb4
51 changes: 51 additions & 0 deletions Grade.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
public class Grade {
public String getLetterGrade(int score) {
if (score < 0 || score > 100) {
return "Invalid score";
} else if (score >= 80) {
return "A";
} else if (score >= 70) {
return "B";
} else if (score >= 50) {
return "C";
} else if (score >= 30) {
return "D";
} else {
return "F";
}
}

public double getGradePoint(int score) {
if (score < 0 || score > 100) {
return -1;
} else if (score >= 80) {
return 4.0;
} else if (score >= 70) {
return 3.0;
} else if (score >= 50) {
return 2.0;
} else if (score >= 30) {
return 1.0;
} else {
return 0.0;
}
}

public boolean isPassing(int score) { return score >= 30; }

public String getRemark(int score) {
if (score < 0 || score > 100) {
return "Invalid score";
} else if (score >= 80) {
return "Excellent";
} else if (score >= 70) {
return "Good";
} else if (score >= 50) {
return "Average";
} else if (score >= 30) {
return "Pass";
} else {
return "Fail";
}
}
}