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
Model it
Student (roll, name, Map<String, Integer> marks). A GradingScheme interface with a percentage โ grade method.
- 2
Two schemes
Implement AbsoluteGrading (90+ = O, 80+ = A+ ...) and a ten-point CGPA scheme; pick one at runtime (polymorphism).
- 3
Enter marks
Validate 0โ100 for each subject; handle bad input.
- 4
Rank the class
Sort with Comparator.comparingDouble(Student::percentage).reversed(); handle ties with the same rank.
- 5
Subject toppers
For each subject, find max marks with streams and list everyone who has it.
- 6
Export
Write a formatted mark sheet per student with Files.writeString(Path.of("sheets", roll + ".txt"), text).
- 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