From ed268db1488ef4fc937bfad53f97c0466143b08a Mon Sep 17 00:00:00 2001 From: fdai7600 Date: Fri, 9 Feb 2024 00:03:05 +0100 Subject: [PATCH] Added hasPassed() in Student Class --- src/main/java/org/example/Student.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/example/Student.java b/src/main/java/org/example/Student.java index 02b0053..1164be2 100644 --- a/src/main/java/org/example/Student.java +++ b/src/main/java/org/example/Student.java @@ -142,4 +142,9 @@ public class Student { return totalCredits > 0 ? totalWeightedGrades / totalCredits : 0.0; } + + public boolean hasPassed() { + double averageGrade = calculateAverageGrade(); + return averageGrade >= 10; + } }