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