Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b5f30c2
chore/add a line in readme.md
wayneSongwx Sep 12, 2024
a679a03
chore/add a line in readme.md (#1)
wayneSongwx Sep 12, 2024
cc9e70f
Revert "chore/add a line in readme.md (#1)" (#2)
wayneSongwx Sep 12, 2024
c03dcf6
chore:correct some of the format
wayneSongwx Sep 13, 2024
1be5c3b
try to merge (#3)
wayneSongwx Sep 13, 2024
fd6e893
chore:correct some formatting problems2
wayneSongwx Sep 13, 2024
00c58fb
Merge branch 'main' into CodeCleanUp
wayneSongwx Sep 13, 2024
8e91826
Code clean up:second correction (#4)
wayneSongwx Sep 13, 2024
fea09a8
correct all formatting warning
wayneSongwx Sep 13, 2024
42a8907
Merge branch 'main' into CodeCleanUp2
wayneSongwx Sep 13, 2024
48cc865
Code clean up2: finish all corrections (#5)
wayneSongwx Sep 13, 2024
3849d0b
fix all bugs
wayneSongwx Sep 14, 2024
14f3323
add bugs.txt
wayneSongwx Sep 14, 2024
956f452
add bugs.txt
wayneSongwx Sep 14, 2024
245bcf7
Merge branch 'main' into CodeCleanUp2
wayneSongwx Sep 14, 2024
833acce
fix all bugs and create 2 files (#6)
wayneSongwx Sep 14, 2024
857c590
fix format
wayneSongwx Sep 14, 2024
8387da1
Update README.md
wayneSongwx Sep 14, 2024
78fbb73
Update README.md
wayneSongwx Sep 14, 2024
6f0d6f3
Update README.md
wayneSongwx Sep 14, 2024
f13d154
add
wayneSongwx Sep 19, 2024
2aad118
Code clean up2 (#7)
wayneSongwx Sep 19, 2024
0596f86
update date
wayneSongwx Sep 19, 2024
25543a1
feature A finished
wayneSongwx Sep 19, 2024
b62869f
I2 feature a (#8)
wayneSongwx Sep 19, 2024
efe0c5c
feature B finished
wayneSongwx Sep 19, 2024
cf06196
feature B-fix conlicts
wayneSongwx Sep 19, 2024
b125111
I2 feature b (#9)
wayneSongwx Sep 19, 2024
9c5665a
Merge branch 'main' of github.com:wayneSongwx/4156-Miniproject-2024-S…
wayneSongwx Sep 19, 2024
c38b4e4
fix checkstyle
wayneSongwx Sep 19, 2024
6061832
Maintain finished
wayneSongwx Sep 19, 2024
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
175 changes: 175 additions & 0 deletions IndividualProject/bugs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
Course
Bug 1:
------------------------------------------------------------------
public boolean enrollStudent() {
enrolledStudentCount++;
return false;
}
------------------------------------------------------------------
is changed to:
------------------------------------------------------------------
public boolean enrollStudent() {
if (enrolledStudentCount < enrollmentCapacity) {
enrolledStudentCount++;
return true;
}
return false;
}
------------------------------------------------------------------


Bug 2:
------------------------------------------------------------------
public boolean dropStudent() {
enrolledStudentCount--;
return false;
}
------------------------------------------------------------------
is changed to:
------------------------------------------------------------------
public boolean dropStudent() {
if (enrolledStudentCount > 0) {
enrolledStudentCount--;
return true;
}
return false;
}
------------------------------------------------------------------

Bug 3:
------------------------------------------------------------------
public String getCourseLocation() {
return this.instructorName;
}
------------------------------------------------------------------
is changed to:
------------------------------------------------------------------
public String getCourseLocation() {
return this.courseLocation;
}
------------------------------------------------------------------

Bug 4:
------------------------------------------------------------------
public String getInstructorName() {
return this.courseLocation;
}
------------------------------------------------------------------
is changed to:
------------------------------------------------------------------
public String getInstructorName() {
return this.instructorName;
}
------------------------------------------------------------------

Bug 5:
------------------------------------------------------------------
public boolean isCourseFull() {
return enrollmentCapacity > enrolledStudentCount;
}
------------------------------------------------------------------
is changed to:
------------------------------------------------------------------
public boolean isCourseFull() {
return enrollmentCapacity >= enrolledStudentCount;
}
------------------------------------------------------------------


Department
Bug 1:
------------------------------------------------------------------
public int getNumberOfMajors() {
return -this.numberOfMajors;
}
------------------------------------------------------------------
is changed to:
------------------------------------------------------------------
public int getNumberOfMajors() {
return this.numberOfMajors;
}
------------------------------------------------------------------

Bug 2:
------------------------------------------------------------------
public String getDepartmentChair() {
return "this.departmentChair";
}
------------------------------------------------------------------
is changed to:
------------------------------------------------------------------
public String getDepartmentChair() {
return this.departmentChair;
}
------------------------------------------------------------------

RouteController
----------------------------------------------------------------------------------------------------
Bug 1:
----------------------------------------------------------------------------------------------------
retrieveDepartment:
...
if (!departmentMapping.containsKey(deptCode.toUpperCase())) {
return new ResponseEntity<>("Department Not Found", HttpStatus.OK);
} else {
return new ResponseEntity<>(departmentMapping.get(deptCode.toUpperCase()).toString(),
HttpStatus.NOT_FOUND);
}
----------------------------------------------------------------------------------------------------
is changed to
----------------------------------------------------------------------------------------------------
...
if (!departmentMapping.containsKey(deptCode.toUpperCase())) {
return new ResponseEntity<>("Department Not Found", HttpStatus.NOT_FOUND);
} else {
return new ResponseEntity<>(departmentMapping.get(deptCode.toUpperCase()), HttpStatus.OK);
}
----------------------------------------------------------------------------------------------------

Bug 2:
----------------------------------------------------------------------------------------------------
retrieveCourse:
...
else {
return new ResponseEntity<>(coursesMapping.get(Integer.toString(courseCode)).toString(),
HttpStatus.FORBIDDEN);
}
----------------------------------------------------------------------------------------------------
is changed to:
----------------------------------------------------------------------------------------------------
else {
return new ResponseEntity<>(coursesMapping.get(Integer.toString(courseCode)).toString(),
HttpStatus.OK);
}
----------------------------------------------------------------------------------------------------


Bug 3:
----------------------------------------------------------------------------------------------------
getMajorCtFromDept:
...
return new ResponseEntity<>("There are: " + -departmentMapping.get(deptCode)
.getNumberOfMajors() + " majors in the department", HttpStatus.OK);
}
return new ResponseEntity<>("Department Not Found", HttpStatus.FORBIDDEN);
----------------------------------------------------------------------------------------------------
is changed to:
----------------------------------------------------------------------------------------------------
....
return new ResponseEntity<>("There are: " + departmentMapping.get(deptCode)
.getNumberOfMajors() + " majors in the department", HttpStatus.OK);
}
return new ResponseEntity<>("Department Not Found", HttpStatus.NOT_FOUND);
----------------------------------------------------------------------------------------------------

Bug 4:
----------------------------------------------------------------------------------------------------
findCourseTime:
return new ResponseEntity<>("The course meets at: " + "some time ",
HttpStatus.OK);
----------------------------------------------------------------------------------------------------
is changed to:
----------------------------------------------------------------------------------------------------
return new ResponseEntity<>("The course meets at: "
+ requestedCourse.getCourseTimeSlot(), HttpStatus.OK);
----------------------------------------------------------------------------------------------------
Binary file added IndividualProject/data.txt
Binary file not shown.
14 changes: 14 additions & 0 deletions IndividualProject/honesty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
I, <Wenxin Song (ws2747)>, have read and understood the following:

CS department's Policies and Procedures on Academic Honesty
The Course Specific Academic Honesty Policies
The assignment specs outlining the consequences of not submitting this pledge and other aspects of the policy
I affirm that I will abide by all the policies stated in the relevant materials from above. I understand that the relevant policies apply to: individual assignments, group projects, and individual examinations.

I also affirm that I understand that all course materials, with the exception of the individual/group project, are subject to the appropriate copyrights and thus will not post them on any public forum or publicly hosted repository, this includes but is not limited to: GitHub, stackoverflow, chegg etc.

I also affirm that I will be 100% honest when evaluating the performance of myself and my teammates when prompted by an assignment or member of the teaching staff.

Finally I affirm that I will not attempt to find any loopholes in these policies for the benefit of myself or others enrolled in the course presently or possibly in the future.

Signed: <Wenxin Song (ws2747)> <September 18, 2024>
9 changes: 7 additions & 2 deletions IndividualProject/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -80,8 +85,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package dev.coms4156.project.individualproject;

import java.io.*;

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

/**
* Represents a course within an educational institution.
* This class stores information about the course, including its location,
* instructor name, time slot, and enrollment capacity.
*/
public class Course implements Serializable {

/**
Expand All @@ -20,44 +26,56 @@ 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++;
if (enrolledStudentCount < enrollmentCapacity) {
enrolledStudentCount++;
return true;
}
return false;
}

/**
/**
* Drops a student from the course if a student is enrolled.
*
* @return true if the student is successfully dropped, false otherwise.
*/
public boolean dropStudent() {
enrolledStudentCount--;
if (enrolledStudentCount > 0) {
enrolledStudentCount--;
return true;
}
return false;
}


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


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


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

public int getEnrollmentCapacity() {
return this.enrollmentCapacity;
}

public int getEnrolledStudentCount() {
return this.enrolledStudentCount;
}

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


Expand All @@ -82,7 +100,7 @@ public void setEnrolledStudentCount(int count) {


public boolean isCourseFull() {
return enrollmentCapacity > enrolledStudentCount;
return enrollmentCapacity >= enrolledStudentCount;
}

@Serial
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
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;

/**
* Represents a department within an educational institution.
Expand Down Expand Up @@ -33,7 +34,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 +43,7 @@ public int getNumberOfMajors() {
* @return The name of the department chair.
*/
public String getDepartmentChair() {
return "this.departmentChair";
return this.departmentChair;
}

/**
Expand Down Expand Up @@ -106,7 +107,7 @@ public String toString() {
result.append(deptCode).append(" ").append(key).append(": ").append(value.toString())
.append("\n");
}
return "result.toString()";
return result.toString();
}

@Serial
Expand Down
Loading
Loading