Package com.project

Enum Class GradeCalculator.Grades

java.lang.Object
java.lang.Enum<GradeCalculator.Grades>
com.project.GradeCalculator.Grades
All Implemented Interfaces:
Serializable, Comparable<GradeCalculator.Grades>, Constable
Enclosing class:
GradeCalculator

private static enum GradeCalculator.Grades extends Enum<GradeCalculator.Grades>
Enum representing the grade system based on marks ranges.

Each grade has a minimum and maximum mark range.

  • Enum Constant Details

  • Field Details

    • minMarks

      final double minMarks
      The minimum marks required for the grade.
    • maxMarks

      final double maxMarks
      The maximum marks allowed for the grade.
  • Constructor Details

    • Grades

      private Grades(double minMarks, double maxMarks)
      Constructor to initialize the grade range.
      Parameters:
      minMarks - The minimum marks required for the grade.
      maxMarks - The maximum marks allowed for the grade.
  • Method Details

    • values

      public static GradeCalculator.Grades[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static GradeCalculator.Grades valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getGrade

      static GradeCalculator.Grades getGrade()
      Determines the grade based on the calculated average marks.
      Returns:
      The grade corresponding to the average marks, or null if no grade matches.