๐ŸŽ™ Free live masterclass ยท Sun, 29 Nov, 7:00 pm IST ยท Java Full Stack roadmap Register free โ†’
Skills101

Student result management

Enter marks for a class, calculate grades, CGPA and rank, and export mark sheets as text files.

Beginnerโฑ 6โ€“8 hours๐Ÿชœ 7 stepsJavaOOPFile I/O

What you'll learn

  • โ—†Inheritance and polymorphism
  • โ—†Sorting with Comparator
  • โ—†Reading and writing files with java.nio

What you'll build

  • โœ“Add students and subject marks
  • โœ“Grade and CGPA calculation
  • โœ“Class rank list and toppers per subject
  • โœ“Export each student's mark sheet

Step-by-step guide

  1. 1

    Model it

    Student (roll, name, Map<String, Integer> marks). A GradingScheme interface with a percentage โ†’ grade method.

  2. 2

    Two schemes

    Implement AbsoluteGrading (90+ = O, 80+ = A+ ...) and a ten-point CGPA scheme; pick one at runtime (polymorphism).

  3. 3

    Enter marks

    Validate 0โ€“100 for each subject; handle bad input.

  4. 4

    Rank the class

    Sort with Comparator.comparingDouble(Student::percentage).reversed(); handle ties with the same rank.

  5. 5

    Subject toppers

    For each subject, find max marks with streams and list everyone who has it.

  6. 6

    Export

    Write a formatted mark sheet per student with Files.writeString(Path.of("sheets", roll + ".txt"), text).

  7. 7

    Load from CSV

    Read an existing marks CSV with Files.readAllLines so you do not retype data.

๐Ÿš€ Make it stand out

  • +Generate PDF mark sheets with a library like OpenPDF
  • +Charts of class performance with JavaFX
  • +Store in SQLite via JDBC