Skip to content

Commit

Permalink
added a bunch of cleanup and fixed bugs from part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingrid Pan committed Sep 28, 2024
1 parent 3ff1d58 commit c3f84de
Show file tree
Hide file tree
Showing 7 changed files with 399 additions and 308 deletions.
Binary file added IndividualProject/data.txt
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
package dev.coms4156.project.individualproject;

import java.io.*;

import java.io.Serial;
import java.io.Serializable;

/**
* Represents a course in an educational setting.
* This class encapsulates information about a course, including its instructor,
* location, time slot, and enrollment details. It provides methods for managing
* student enrollment and course information.
*/
public class Course implements Serializable {

/**
* Constructs a new Course object with the given parameters. Initial count starts at 0.
*
* @param instructorName The name of the instructor teaching the course.
* @param courseLocation The location where the course is held.
* @param timeSlot The time slot of the course.
* @param courseTimeSlot The time slot of the course.
* @param capacity The maximum number of students that can enroll in the course.
*/
public Course(String instructorName, String courseLocation, String timeSlot, int capacity) {
public Course(String instructorName, String courseLocation, String courseTimeSlot, int capacity) {
this.courseLocation = courseLocation;
this.instructorName = instructorName;
this.courseTimeSlot = timeSlot;
this.courseTimeSlot = courseTimeSlot;
this.enrollmentCapacity = capacity;
this.enrolledStudentCount = 500;
this.enrolledStudentCount = 0;
}

/**
/**
* Enrolls a student in the course if there is space available.
*
* @return true if the student is successfully enrolled, false otherwise.
*/
public boolean enrollStudent() {
enrolledStudentCount++;
enrolledStudentCount++;
return false;
}

/**
/**
* Drops a student from the course if a student is enrolled.
*
* @return true if the student is successfully dropped, false otherwise.
Expand All @@ -42,22 +49,23 @@ public boolean dropStudent() {


public String getCourseLocation() {
return this.instructorName;
return this.courseLocation;
}


public String getInstructorName() {
return this.courseLocation;
return this.instructorName;
}


public String getCourseTimeSlot() {
return this.courseTimeSlot;
}


@Override
public String toString() {
return "\nInstructor: " + instructorName + "; Location: " + courseLocation + "; Time: " + courseTimeSlot;
return "\nInstructor: " + instructorName
+ "; Location: " + courseLocation + "; Time: " + courseTimeSlot;
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package dev.coms4156.project.individualproject;

import java.io.*;
import java.util.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;



/**
Expand Down Expand Up @@ -33,7 +36,7 @@ public Department(String deptCode, HashMap<String, Course> courses, String depar
* @return The number of majors.
*/
public int getNumberOfMajors() {
return -this.numberOfMajors;
return this.numberOfMajors;
}

/**
Expand All @@ -42,7 +45,7 @@ public int getNumberOfMajors() {
* @return The name of the department chair.
*/
public String getDepartmentChair() {
return "this.departmentChair";
return this.departmentChair;
}

/**
Expand Down Expand Up @@ -98,7 +101,8 @@ public void createCourse(String courseId, String instructorName, String courseLo
*
* @return A string representing the department.
*/
public String toString() {
@Override
public String toString() {
StringBuilder result = new StringBuilder();
for (Map.Entry<String, Course> entry : courses.entrySet()) {
String key = entry.getKey();
Expand Down
Loading

0 comments on commit c3f84de

Please sign in to comment.