|
@ -1,46 +1,96 @@ |
|
|
package org.example; |
|
|
package org.example; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* The Course class represents a course in a curriculum. |
|
|
|
|
|
* Each course has a name, code, and credit value. |
|
|
|
|
|
*/ |
|
|
public class Course { |
|
|
public class Course { |
|
|
|
|
|
|
|
|
|
|
|
/** The name of the course. */ |
|
|
private String courseName; |
|
|
private String courseName; |
|
|
|
|
|
|
|
|
|
|
|
/** The code of the course. */ |
|
|
private String courseCode; |
|
|
private String courseCode; |
|
|
|
|
|
|
|
|
|
|
|
/** The credit value of the course. */ |
|
|
private int courseCredit; |
|
|
private int courseCredit; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Constructs a new Course object with default values. |
|
|
|
|
|
*/ |
|
|
public Course() { |
|
|
public Course() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Constructs a new Course object with specified values. |
|
|
|
|
|
* |
|
|
|
|
|
* @param courseName The name of the course. |
|
|
|
|
|
* @param courseCode The code of the course. |
|
|
|
|
|
* @param courseCredit The credit value of the course. |
|
|
|
|
|
*/ |
|
|
public Course(String courseName, String courseCode, int courseCredit) { |
|
|
public Course(String courseName, String courseCode, int courseCredit) { |
|
|
this.courseName = courseName; |
|
|
this.courseName = courseName; |
|
|
this.courseCode = courseCode; |
|
|
this.courseCode = courseCode; |
|
|
this.courseCredit = courseCredit; |
|
|
this.courseCredit = courseCredit; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Retrieves the name of the course. |
|
|
|
|
|
* |
|
|
|
|
|
* @return The name of the course. |
|
|
|
|
|
*/ |
|
|
public String getCourseName() { |
|
|
public String getCourseName() { |
|
|
return courseName; |
|
|
return courseName; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Sets the name of the course. |
|
|
|
|
|
* |
|
|
|
|
|
* @param courseName The name of the course. |
|
|
|
|
|
*/ |
|
|
public void setCourseName(String courseName) { |
|
|
public void setCourseName(String courseName) { |
|
|
this.courseName = courseName; |
|
|
this.courseName = courseName; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Retrieves the code of the course. |
|
|
|
|
|
* |
|
|
|
|
|
* @return The code of the course. |
|
|
|
|
|
*/ |
|
|
public String getCourseCode() { |
|
|
public String getCourseCode() { |
|
|
return courseCode; |
|
|
return courseCode; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Sets the code of the course. |
|
|
|
|
|
* |
|
|
|
|
|
* @param courseCode The code of the course. |
|
|
|
|
|
*/ |
|
|
public void setCourseCode(String courseCode) { |
|
|
public void setCourseCode(String courseCode) { |
|
|
this.courseCode = courseCode; |
|
|
this.courseCode = courseCode; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Retrieves the credit value of the course. |
|
|
|
|
|
* |
|
|
|
|
|
* @return The credit value of the course. |
|
|
|
|
|
*/ |
|
|
public int getCourseCredit() { |
|
|
public int getCourseCredit() { |
|
|
return courseCredit; |
|
|
return courseCredit; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Sets the credit value of the course. |
|
|
|
|
|
* |
|
|
|
|
|
* @param courseCredit The credit value of the course. |
|
|
|
|
|
*/ |
|
|
public void setCourseCredit(int courseCredit) { |
|
|
public void setCourseCredit(int courseCredit) { |
|
|
this.courseCredit = courseCredit; |
|
|
this.courseCredit = courseCredit; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Prints the information of the course to the console. |
|
|
|
|
|
*/ |
|
|
public void printCourseInfo() { |
|
|
public void printCourseInfo() { |
|
|
System.out.println("Course Name: " + courseName); |
|
|
System.out.println("Course Name: " + courseName); |
|
|
System.out.println("Course Code: " + courseCode); |
|
|
System.out.println("Course Code: " + courseCode); |
|
|