You will build a command-line Student Grade Manager for a fictional school. The program allows a school administrator to register students, record their module grades, view reports, and look up individual students — all from the terminal.
This assignment is designed to take 2–3 days. Read the full brief before writing any code.
ScannerprintfYou are building a grade management tool for HYF Academy. The academy runs a backend track with the following fixed modules:
1. Java Basics
2. Control Flow
3. OOP Fundamentals
4. Arrays & Collections
5. Input & Output
Each module is graded on a scale of 0–100. A student passes a module with a grade of 55 or above. A student passes the overall track if their average grade is 60 or above.
Your project must follow this package structure:
com.hyfacademy
├── model
│ └── Student.java
├── service
│ └── GradeService.java
├── util
│ └── GradeUtils.java
└── Main.java
Student — com.hyfacademy.modelA Student represents one enrolled student.
Fields (all private):
name (String)studentId (String) — format: "HYF-001", "HYF-002", etc.grades (int[]) — one grade per module, fixed size of 5Static field:
totalStudents (int) — incremented every time a Student is createdConstructors:
Student(String name, String studentId) — initialises grades as an array of 5 zerosGetters: for all fields Setter:
setGrade(int moduleIndex, int grade) — validates that moduleIndex is between 0–4 and grade is between 0–100; prints an error message and does nothing if invalidMethods:
getTotalStudents() — static, returns the count of students createdtoString() — returns a single-line summary: "[HYF-001] Alice — Avg: 72.40 — PASS"GradeUtils — com.hyfacademy.utilA utility class (private constructor, all static methods) for grade calculations and formatting.
Constants (static final):
MODULE_PASS_MARK = 55 (int)TRACK_PASS_AVERAGE = 60.0 (double)MODULE_COUNT = 5 (int)MODULE_NAMES — a String[] containing the five module names listed aboveMethods:
calculateAverage(int[] grades) — returns the average as a doubleisPassing(double average) — returns true if average is ≥ TRACK_PASS_AVERAGEisModulePassing(int grade) — returns true if grade ≥ MODULE_PASS_MARKgetLetterGrade(double average) — returns a letter grade:
"A", 80–89 → "B", 70–79 → "C", 60–69 → "D", below 60 → "F"formatGrade(int grade) — returns the grade as a right-aligned 3-character string (e.g. " 87", "100")GradeService — com.hyfacademy.serviceThe service layer that manages the list of students and drives the application logic.
Fields (all private):
students (Student[]) — fixed-size array, maximum 20 studentsstudentCount (int) — tracks how many students have been addedscanner (Scanner) — one shared Scanner instanceStatic constant:
MAX_STUDENTS = 20 (int)Methods:
addStudent() — prompts for name and auto-generates the student ID ("HYF-001", "HYF-002", etc.)enterGrades() — prompts the user to select a student by ID, then enter a grade for each of the 5 modules one by oneviewAllStudents() — prints a formatted table of all students (see output format below)viewStudentReport()— prompts for a student ID and prints a detailed report for that student (see output format below)findStudentById(String id) — private helper, returns the matching Student or nullrun() — the main loop that shows the menu and handles input until the user exitsMain — com.hyfacademyThe entry point. Creates a GradeService and calls run().
public class Main {
public static void main(String[] args) {
GradeService service = new GradeService();
service.run();
}
}
╔══════════════════════════════════════╗
║ HYF ACADEMY — GRADE MGR ║
╚══════════════════════════════════════╝
1. Add student
2. Enter grades
3. View all students
4. View student report
5. Exit
══════════════════════════════════════
Choose an option:
══════════════════════════════════════════════════════════════
ID NAME AVERAGE GRADE STATUS
══════════════════════════════════════════════════════════════
HYF-001 Alice van der Berg 82.40 B PASS
HYF-002 Bob Jansen 53.20 F FAIL
HYF-003 Carol de Groot 91.00 A PASS
══════════════════════════════════════════════════════════════
Total students: 3 Passing: 2 Failing: 1
══════════════════════════════════════════════════════════════
══════════════════════════════════════
STUDENT REPORT
══════════════════════════════════════
ID : HYF-001
Name : Alice van der Berg
──────────────────────────────────────
MODULE GRADES
──────────────────────────────────────
Java Basics : 88 PASS
Control Flow : 76 PASS
OOP Fundamentals : 91 PASS
Arrays & Collections : 70 PASS
Input & Output : 87 PASS
──────────────────────────────────────
Average : 82.40
Grade : B
Status : ✓ PASS
══════════════════════════════════════
Student fields are all private with appropriate getters/settersGradeUtils has a private constructor and all methods are staticGradeService uses GradeUtils methods — no duplicate grade logicstatic is used only where appropriate (not to avoid writing proper OOP)