Update src/main/java/models/Teacher.java
This commit is contained in:
@@ -32,22 +32,26 @@ public class Teacher extends User {
|
||||
return myCourses;
|
||||
}
|
||||
|
||||
public void showMyCourses() {
|
||||
public String getMyCoursesDisplay() {
|
||||
if (myCourses.isEmpty()) {
|
||||
System.out.println(" You don't teach any course yet.");
|
||||
return " You don't teach any course yet.";
|
||||
} else {
|
||||
System.out.println("\n My Courses:");
|
||||
StringBuilder sb = new StringBuilder("\n My Courses:\n");
|
||||
for (int i = 0; i < myCourses.size(); i++) {
|
||||
System.out.println(" " + (i+1) + ". " + myCourses.get(i));
|
||||
sb.append(" ").append(i+1).append(". ").append(myCourses.get(i)).append("\n");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public void showStudentsInCourse(Course course) {
|
||||
if (!myCourses.contains(course)) {
|
||||
System.out.println(" You don't teach this course!");
|
||||
return;
|
||||
public boolean checkCourseOwnership(Course course) {
|
||||
return myCourses.contains(course);
|
||||
}
|
||||
course.showStudents();
|
||||
|
||||
public String getStudentsDisplayForCourse(Course course) {
|
||||
if (!myCourses.contains(course)) {
|
||||
return "You don't teach this course!";
|
||||
}
|
||||
return course.getStudentsDisplay();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user