SKILLS Sample problem
Problem: Student Grading System
The goal of this problem is to implement a simple student grading system for a high school. The
system will allow teachers to enter student data, calculate their grades, and generate a report. It
will also save the results to a file.
Problem Description:
You are tasked with creating a Java program that performs the following operations for each
student:
1. Student Information: Collect information about 120 students from a comma delimited
file (students.txt):
○ Name (first and last)
○ Student number
○ Marks obtained in three subjects (out of 100) (each mark separated by commas)
2. Calculate Grades:
○ Calculate the average marks across the three subjects.
○ Based on the average, assign a grade:
■ A if average >= 90
■ B if 70 <= average < 90
■ C if 50 <= average < 70
■ F if average < 50
3. File I/O:
○ Save the following data for each student to a file (student_report.txt):
■ Name
■ Student Number
■ Average of all subjects
■ Grade
4. Display a Report:
○ Display menu for user to chose what action to perform
○ Display a list of all students along with their grades on the console.
○ Allow user to enter a student name and display their marks, average and grade
■ If a student is not found, display appropriate message
○ Allow user to enter a student number and display their marks, average and grade
■ If a student is not found, display appropriate message
5. Array:
○ Store the student data (Name, Student Number, Marks, Average, and Grade) in
an array.
6. Object-Oriented Programming Concepts:
○ Create a Student class to store individual student data.
○ Use a GradingSystem class to manage student records, calculate grades, and
handle file I/O.
========================================================================
SOLUTION:
Pseudocode
Create Student class with attributes:
- name
- studentNumber
- marks (array of 3 subjects)
- average
- grade
and methods:
● calculateAverage(): Compute the average marks
● calculateGrade(): Assign a grade based on average
Create GradingSystem class with methods:
- readInputFile(): Get student data from the input file
- saveToFile(): Save student report to a file
- displayReport(): Show student grades on the console
- findStudentName(): Find the location of a student based on name
- findStudentNumber(): Find the location of a student based on
student number
main() method
- Load the file using readInputFile() method
- Display menu to user
● Save to file
● Display student report
● Find name in list
● Find student number in list
Code: https://onlinegdb.com/W1RSYhjv_