Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added IndividualProject/data.txt
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package dev.coms4156.project.individualproject;

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

/**
* Sets up the class Course.
*/
public class Course implements Serializable {

/**
Expand All @@ -20,17 +24,17 @@ public Course(String instructorName, String courseLocation, String timeSlot, int
this.enrolledStudentCount = 500;
}

/**
/**
* 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 @@ -39,47 +43,84 @@ public boolean dropStudent() {
enrolledStudentCount--;
return false;
}

/**
* Retrieves the course location if there is any.
*
* @return The location of the course.
*/

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

/**
* Retrieves the instructor name.
*
* @return The instructor name.
*/

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

/**
* Retrieves the time slot for a course.
*
* @return The time slot for the course.
*/

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

/**
* Creates a string with course information.
*
* @return A string with the instructor name, location, and time for a course.
*/

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

/**
* Reassigns a new instructor for a course.
*
* @param newInstructorName The name of the new instructor.
*/

public void reassignInstructor(String newInstructorName) {
this.instructorName = newInstructorName;
}

/**
* Reassigns a new location for a course.
*
* @param newLocation The name of the new location.
*/

public void reassignLocation(String newLocation) {
this.courseLocation = newLocation;
}

/**
* Reassigns a new time for a course.
*
* @param newTime The new time for a course.
*/

public void reassignTime(String newTime) {
this.courseTimeSlot = newTime;
}

/**
* Sets the enrolled student amount to the count being passed in.
*
* @param count The count to set the enrolled student amount.
*/

public void setEnrolledStudentCount(int count) {
this.enrolledStudentCount = count;
}

/**
* Check if the course is full.
*
* @return False if the course isn't full, true if it is.
*/

public boolean isCourseFull() {
return enrollmentCapacity > enrolledStudentCount;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package dev.coms4156.project.individualproject;

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



/**
Expand Down Expand Up @@ -33,7 +35,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 +44,7 @@ public int getNumberOfMajors() {
* @return The name of the department chair.
*/
public String getDepartmentChair() {
return "this.departmentChair";
return this.departmentChair;
}

/**
Expand All @@ -57,14 +59,14 @@ public HashMap<String, Course> getCourseSelection() {
/**
* Increases the number of majors in the department by one.
*/
public void addPersonToMajor() {
public void increaseNumberOfMajors() {
numberOfMajors++;
}

/**
* Decreases the number of majors in the department by one if it's greater than zero.
*/
public void dropPersonFromMajor() {
public void decreaseNumberOfMajors() {
numberOfMajors--;
}

Expand Down
Loading
Loading