Fakultas Ilmu Komputer UI

Commit f84fa060 authored by hazlazuardi's avatar hazlazuardi
Browse files

Resolve conflict with master

parents 742932d2 33f59e94
Pipeline #81301 failed with stages
in 20 seconds
rpl,ade,1:01:01,1:01:02
adpro,daya,5:05:05,7:07:07
daa,there,4:04:04,13:01:01
daa,there,4:04:04,13:01:01
\ No newline at end of file
......@@ -40,5 +40,21 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="JUnit5.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.4.2/junit-jupiter-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.4.2/junit-jupiter-api-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.4.2/junit-platform-commons-1.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.4.2/junit-jupiter-params-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.4.2/junit-jupiter-engine-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.4.2/junit-platform-engine-1.4.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
\ No newline at end of file
st,t1,rpl,adpro,daa
admin,Admin
st,Student
ta,Teaching Assistant
a,Student
b,Teaching Assistant
package Softeng.Group3.SiJadwal.actor;
import Softeng.Group3.SiJadwal.model.Course;
import Softeng.Group3.SiJadwal.repository.CourseList;
import Softeng.Group3.SiJadwal.repository.UserList;
import Softeng.Group3.SiJadwal.Main;
......@@ -21,7 +23,10 @@ public class Admin extends Role {
@Override
public void exclusiveActions() {
System.out.println("6. Add Course");
System.out.println("7. Change user role");
System.out.println("7. Update Course");
System.out.println("8. Delete Course");
System.out.println("9. Change User Role");
System.out.println("10. Delete User");
}
@Override
......@@ -33,9 +38,10 @@ public class Admin extends Role {
System.out.println("Course Name?");
courseName = in.next();
for(int i = 0; i < courseList.getCourseList().size(); i++){
if(courseName == courseList.getCourseList().get(i).getCourseName());
System.out.println("Course already exists");
return;
if(courseName.equalsIgnoreCase(courseList.getCourseList().get(i).getCourseName())){
System.out.println("Course already exists");
return;
}
}
System.out.println("Lecturer Name?");
lecturer = in.next();
......@@ -48,6 +54,41 @@ public class Admin extends Role {
break;
case 7:
System.out.println("Course you want to update: ");
courseName = in.next();
CourseList updateCourse = new CourseList();
if(updateCourse.getCourse(courseName) == null){
System.out.println("The course does not exist");
return;
}
System.out.println("Lecturer Name?");
lecturer = in.next();
System.out.println("Start Time? hour:minute:second");
startTime = Time.valueOf(in.next());
System.out.println("End Time? hour:minute:second");
endTime = Time.valueOf(in.next());
courseList.updateCourse(courseName, lecturer, startTime, endTime);
System.out.println(courseName + " Course Updated");
break;
case 8:
CourseList delCourse = new CourseList();
System.out.println("Please enter the course name that you want to delete: ");
String courseDel = in.next();
if(delCourse.getCourse(courseDel) == null){
System.out.println("The user does not exist");
return;
}
delCourse.deleteCourse(courseDel);
System.out.println("Course deleted.");
break;
case 9:
UserList userList = new UserList();
System.out.println("Please enter the username that you want to change the role: ");
......@@ -68,6 +109,22 @@ public class Admin extends Role {
userList.updateRole(user, RoleType.intToRole(newUserType));
break;
case 10:
UserList userListDel = new UserList();
System.out.println("Please enter the username that you want to delete: ");
String userDel = in.next();
if(userListDel.getUser(userDel) == null){
System.out.println("The user does not exist");
return;
}
userListDel.deleteUser(userDel);
System.out.println("User deleted.");
break;
default:
}
}
......
......@@ -27,6 +27,7 @@ public class Student extends Role {
System.out.println("7. See the list of timetable");
System.out.println("8. Add Course to a timetable");
System.out.println("9. Find a timetable");
System.out.println("10. Delete a timetable");
}
@Override
......@@ -39,28 +40,29 @@ public class Student extends Role {
System.out.println("Create a new timetable");
System.out.println("===============================");
TimetableList TimeList = new TimetableList();
Timetable newTimetable;
System.out.println("Timetable Name?");
timetableName = in.next();
newTimetable = timetableList.getTimetable(timetableName, Main.currentUser);
if (newTimetable != null) {
System.out.println("Timetable exists.. Updating..");
} else {
System.out.println("Creating new Timetable...");
newTimetable = new Timetable();
newTimetable.setTimetableName(timetableName);
newTimetable.setOwner(Main.currentUser);
System.out.println(Main.currentUser.getUsername());
if(timetableList.getTimetable(timetableName, Main.currentUser) != null){
System.out.println("The user does not exist");
return;
}
System.out.println("Creating new Timetable...");
newTimetable = new Timetable();
newTimetable.setTimetableName(timetableName);
newTimetable.setOwner(Main.currentUser);
System.out.println(Main.currentUser.getUsername());
// Set Timetable owner
System.out.println("Pick some courses to add (Comma separated): ");
courseList.listToString(courseList.getCourseList());
// Reset maybe?
String[] coursesPicked = null;
coursesPicked = in.next().split(",");
String[] coursesPicked = in.next().split(",");
System.out.println("Picked: ");
for (String s: coursesPicked) {
System.out.println(s + " " + courseList.getCourseList().get(Integer.parseInt(s) - 1).getCourseName());
......@@ -73,10 +75,10 @@ public class Student extends Role {
System.out.println(newTimetable.getTimetableName());
int i = 1;
for (Course c: newTimetable.getCourses()) {
System.out.println(i++ + " " + c.getCourseName());
System.out.println(i++ + ". " + c.getCourseName());
}
timetableList.addTimetable(newTimetable);
timetableList.addTimetable(timetableName, newTimetable);
break;
case 7:
......@@ -133,6 +135,23 @@ public class Student extends Role {
break;
}
case 10:
System.out.println("Please enter the timetable name that you want to delete: ");
String tableDel = in.next();
Timetable delTable = timetableList.getTimetable(tableDel, Main.currentUser);
if(delTable == null){
System.out.println("The timetable does not exist");
return;
}
timetableList.deleteTimetable(delTable);
System.out.println("Timetable deleted.");
break;
default:
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment