0% found this document useful (0 votes)
7 views

Sample problem with solution (2)

The document outlines a problem to create a student grading system in Java, which involves collecting student data, calculating grades based on average marks, and generating a report. It specifies the need for a Student class to store individual data and a GradingSystem class to manage records and file operations. The solution includes pseudocode for the classes and methods required to implement the system, along with a main method for user interaction.

Uploaded by

jasleenyt15
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Sample problem with solution (2)

The document outlines a problem to create a student grading system in Java, which involves collecting student data, calculating grades based on average marks, and generating a report. It specifies the need for a Student class to store individual data and a GradingSystem class to manage records and file operations. The solution includes pseudocode for the classes and methods required to implement the system, along with a main method for user interaction.

Uploaded by

jasleenyt15
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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_

You might also like