-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLMS.java
More file actions
144 lines (137 loc) · 4.12 KB
/
LMS.java
File metadata and controls
144 lines (137 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import java.util.Scanner;
/**
* @author JavaDoc
* Used as facade to call methods.
*/
public class LMS {
private static UserList userList;
private static CourseList courseList;
private static Scanner keyboard = new Scanner(System.in);
public LMS(){
this.userList = userList.getInstance();
this.courseList = courseList.getInstance();
}
/**
* Calls login in userList class.
* @return Returns the user that logged in. If invalid, returns null.
*/
public User Login(){
return userList.login();
}
/**
* Call loginAuthor in userList class.
* @return newly logged in author if valid. Otherwise null.
*/
public User LoginAuthor(){
return userList.loginAuthor();
}
/**
* Calls registerUser in userList().
* @return newly registered User.
*/
public User registerUser(){
return userList.registerUser();
}
/**
* Calls registerAuthor in userList.
* @return newly registered Author.
*/
public User registerAuthor(){
return userList.registerAuthor();
}
/**
* Calls viewCourses in courseList.
*/
public void displayCourses(){
courseList.viewCourses();
}
public void displayCreatedCourses(User user){
for(int i = 1; i <= user.getCreatedCourses().size(); i++){
System.out.println(i + ". ");
System.out.println(user.getCreatedCourses().get(i-1).getTitle());
}
}
/**
* Finds course by title and deletes from course list.
*/
public void deleteCourse(){
System.out.print("Please enter course to be deleted: ");
courseList.deleteCourse(courseList.getCourseByTitle(keyboard.next()));
keyboard.nextLine();
System.out.println("Course deleted");
}
/**
*
* @param user passes in user as a object and checks it's enrolled courses
* and prints them out to the user
* calls the method that is implemented in courseList
*/
public void displayEnrolledCourses(User user){
courseList.displayEnrolledCourses(user);
}
/**
* @param user - passes in user as a object (author only)
* calls the method that is implemented in courseList to add a course
* and it creates a course for author and adds it to the course array
* that is within CourseList class
*/
public void createCourse(User user){
courseList.addCourse(courseList.createCourse(user));
}
/**
* @param user passes in user as a object (author only)
* checks to see if the course that author wants to edit is within the course
* arrayList and if it is then gives teh author the option to edit the course
* edit things such as modules, topics, quiz, etc...
*/
public void editCourse(User user){
courseList.editCourse(user);
}
/**
* lets the user comment on a course
* @param user - passes in user as a object (user)
*/
public void courseComment(User user){
courseList.courseComment(user);
}
/**
* lets the user Review on a course
* @param user - passes in a user as a object (user)
*/
public void courseReview(User user){
courseList.courseReview(user);
}
/**
* You can check the courseDetails such as
* who created the course, title, description, and
* modules
*/
public void viewCourseDetails(){
courseList.getCourseDetails();
}
/**
*
* @param user - enters the user and checks which course they are enrolled in
* and they take the course
* @throws InterruptedException
*/
public void takeCourse(User user) throws InterruptedException{
courseList.takeCourse(user);
}
/**
* Calls the functions in CourseList class
* which prints the course to the file
*/
public void printToFile(){
courseList.printCourseToFile();
}
/**
* Prints the comments from a course
* so user can see what comments they would like to
* reply on
* @param user
*/
public void courseReply(User user){
courseList.courseReply(user);
}
}