Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Course Enrollment and Grade Management System in Java

The Course Enrollment and Grade Management System is a Java application for universities to manage student enrollment, course assignments, and grade tracking using object-oriented principles. It includes classes for Student and Course, with methods for enrolling students and assigning grades, as well as a CourseManagement class for managing operations. An interactive command-line interface allows administrators to perform various functions related to course and student management.

Uploaded by

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

Course Enrollment and Grade Management System in Java

The Course Enrollment and Grade Management System is a Java application for universities to manage student enrollment, course assignments, and grade tracking using object-oriented principles. It includes classes for Student and Course, with methods for enrolling students and assigning grades, as well as a CourseManagement class for managing operations. An interactive command-line interface allows administrators to perform various functions related to course and student management.

Uploaded by

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

Course Enrollment and Grade

Management System in Java


Introduction
The Course Enrollment and Grade Management System is a Java-based application designed
for universities to efficiently manage student enrollment, course assignments, and grade
tracking. This system implements object-oriented principles, including encapsulation, static
methods, and access control, ensuring a well-structured and maintainable codebase.

Student Class
The Student class encapsulates student-related data such as name, ID, and enrolled courses.
It provides methods for enrolling in courses and assigning grades.

import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
import java.util.List;

public class Student {


private String name;
private String studentID;
private List<Course> enrolledCourses;
private Map<Course, Double> grades;

public Student(String name, String studentID) {


this.name = name;
this.studentID = studentID;
this.enrolledCourses = new ArrayList<>();
this.grades = new HashMap<>();
}

public String getName() { return name; }


public void setName(String name) { this.name = name; }

public String getStudentID() { return studentID; }


public void setStudentID(String studentID) { this.studentID = studentID; }

public List<Course> getEnrolledCourses() { return enrolledCourses; }


public void enrollCourse(Course course) {
if (!enrolledCourses.contains(course)) {
enrolledCourses.add(course);
course.incrementEnrolledStudents();
}
}

public void assignGrade(Course course, double grade) {


if (enrolledCourses.contains(course)) {
grades.put(course, grade);
}
}

public double getGrade(Course course) {


return grades.getOrDefault(course, 0.0);
}
}

Course Class
The Course class stores course details, including course code, name, and maximum capacity.
A static variable tracks the total number of enrolled students across all courses.

public class Course {


private String courseCode;
private String courseName;
private int maxCapacity;
private static int totalEnrolledStudents = 0;

public Course(String courseCode, String courseName, int maxCapacity) {


this.courseCode = courseCode;
this.courseName = courseName;
this.maxCapacity = maxCapacity;
}

public String getCourseCode() { return courseCode; }


public String getCourseName() { return courseName; }
public int getMaxCapacity() { return maxCapacity; }

public static int getTotalEnrolledStudents() {


return totalEnrolledStudents;
}

public void incrementEnrolledStudents() {


totalEnrolledStudents++;
}
}

CourseManagement Class
This class manages course enrollment, student registration, and grade calculations using static
methods.

import java.util.ArrayList;
import java.util.List;

public class CourseManagement {


private static List<Course> courses = new ArrayList<>();

public static void addCourse(String courseCode, String courseName, int maxCapacity) {


courses.add(new Course(courseCode, courseName, maxCapacity));
}

public static void enrollStudent(Student student, Course course) {


student.enrollCourse(course);
}

public static void assignGrade(Student student, Course course, double grade) {


student.assignGrade(course, grade);
}

public static double calculateOverallGrade(Student student) {


double total = 0;
int count = 0;
for (Course course : student.getEnrolledCourses()) {
total += student.getGrade(course);
count++;
}
return count == 0 ? 0 : total / count;
}
}

Administrator Interface
An interactive command-line interface allows administrators to perform operations efficiently.

import java.util.Scanner;
public class AdminInterface {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

while (true) {
System.out.println("1. Add Course");
System.out.println("2. Enroll Student");
System.out.println("3. Assign Grade");
System.out.println("4. Calculate Overall Grade");
System.out.println("5. Exit");
int choice = scanner.nextInt();

if (choice == 5) break;
}
scanner.close();
}
}

Output Screenshot
References
● Deitel, P. J., & Deitel, H. M. (2018). Java: How to Program (11th ed.). Pearson.
● Oracle. (n.d.). Java Platform, Standard Edition Documentation. Retrieved from
https://docs.oracle.com/javase/8/docs/
● Horstmann, C. S. (2019). Core Java Volume I—Fundamentals (11th ed.). Pearson.

You might also like