Fakultas Ilmu Komputer UI

Commit 8582d1fe authored by saddamonpc's avatar saddamonpc
Browse files

Finish iteration 2

parent 19ade3bd
...@@ -49,47 +49,51 @@ public class Main { ...@@ -49,47 +49,51 @@ public class Main {
Scanner sc = new Scanner(System.in); Scanner sc = new Scanner(System.in);
String q = ""; String q = "";
String currentLogin = ""; String currentLogin = "";
CourseList courseList;
UserList userList;
// -------- Uncomment all of this for the "hardcoded" version. // // -------- Uncomment all of this for the "hardcoded" version.
// Uncomment to add a new fresh userList and courseList // // Uncomment to add a new fresh userList and courseList
CourseList courseList = new CourseList(); // courseList = new CourseList();
UserList userList = new UserList(); // userList = new UserList();
//
// Uncomment here to add a new TA or Admin // // Uncomment here to add a new TA or Admin
// This will add false users, for checking users in the arraylist. (NECESSARY) // // This will add false users, for checking users in the arraylist. (NECESSARY)
new Student("falseStudent", "False Student", Long.valueOf("123456789"), userList); // new Student("falseStudent", "False Student", Long.valueOf("123456789"), userList);
new TeachingAssistant("falseTA", "False TA", Long.valueOf("123456789"), userList); // new TeachingAssistant("falseTA", "False TA", Long.valueOf("123456789"), userList);
new Admin("falseAdmin", "False Admin", userList); // new Admin("falseAdmin", "False Admin", userList);
//
// Add testStudent // // Add testStudent
new Student("akuStudent", "Aku Student", Long.valueOf("123456789"), userList); // new Student("akuStudent", "Aku Student", Long.valueOf("123456789"), userList);
//
// Add testTa with a mock calendar and schedule // // Add testTa with a mock calendar and schedule
TeachingAssistant testTa = new TeachingAssistant("akuTA", "Aku Asdos", Long.valueOf("123456789"), userList); // TeachingAssistant testTa = new TeachingAssistant("akuTA", "Aku Asdos", Long.valueOf("123456789"), userList);
testTa.setSchedule("monday", "Free", "12:00", "17:00"); // testTa.setSchedule("monday", "Free", "12:00", "17:00");
testTa.setSchedule("tuesday", "Free", "08:00", "11:00"); // testTa.setSchedule("tuesday", "Free", "08:00", "11:00");
testTa.setSchedule("tuesday", "Free", "12:00", "15:00"); // testTa.setSchedule("tuesday", "Free", "12:00", "15:00");
testTa.setSchedule("saturday", "Busy", "07:00", "21:00"); // testTa.setSchedule("saturday", "Busy", "07:00", "21:00");
testTa.setSchedule("sunday", "Free", "12:00", "17:00"); // testTa.setSchedule("sunday", "Free", "12:00", "17:00");
new TeachingAssistant("anotherTA", "Another TA", Long.valueOf("1"), userList); // new TeachingAssistant("anotherTA", "Another TA", Long.valueOf("1"), userList);
//
// Add testAdmin // // Add testAdmin
new Admin("akuAdmin", "Aku Admin", userList); // new Admin("akuAdmin", "Aku Admin", userList);
//
// Add false course // // Add false course
new Course("False Course", "FALSECOURSE", "False Professor", 0, courseList); // new Course("False Course", "FALSECOURSE", "False Professor", 0, courseList);
//
// Add mock courses // // Add mock courses
new Course("Mata Kuliah", "MATKUL420", "Aku Dosen", 4, courseList); // new Course("Mata Kuliah", "MATKUL420", "Aku Dosen", 4, courseList);
new Course("Software Engineering", "SOFTENG2021", "Aku Professor", 3, courseList); // new Course("Software Engineering", "SOFTENG2021", "Aku Professor", 3, courseList);
new Course("Fisika", "PHYS101", "Aku Dosen Fisika", 4, courseList); // new Course("Fisika", "PHYS101", "Aku Dosen Fisika", 4, courseList);
//
// Save the course // // Save the course
saveList(courseList, userList); // saveList(courseList, userList);
//
// // ---------------- END OF "HARDCODED" VERSION
// // PRODUCTION BUILD: Open all persistent storage // PRODUCTION BUILD: Open all persistent storage
// CourseList courseList = openCourseList(); courseList = openCourseList();
// UserList userList = openUserList(); userList = openUserList();
// // Store userList test // // Store userList test
// try { // try {
...@@ -148,10 +152,8 @@ public class Main { ...@@ -148,10 +152,8 @@ public class Main {
break; break;
case "ADD APPOINTMENT": case "ADD APPOINTMENT":
System.out.println("Choose date 'dd:mm' . Example, '31:12': "); System.out.println("Choose date 'dd/mm' . Example, '31/12': ");
String day = sc.nextLine().toLowerCase(); String day = sc.nextLine().toLowerCase();
// System.out.println("Your name: ");
// Student name = sc.nextLine();
System.out.println("Your TA's username: "); System.out.println("Your TA's username: ");
String ta = sc.nextLine(); String ta = sc.nextLine();
System.out.println("Add start time 'XX:XX'. Example, '08:00': "); System.out.println("Add start time 'XX:XX'. Example, '08:00': ");
...@@ -162,7 +164,7 @@ public class Main { ...@@ -162,7 +164,7 @@ public class Main {
String description = sc.nextLine(); String description = sc.nextLine();
String status = "Pending"; String status = "Pending";
currentStudent.setAppointment(day, ta, startTime, endTime, description, status, userList); currentStudent.setAppointment(day, ta, startTime, endTime, description, status, userList);
System.out.println("Sucessfully added a new appointment!"); System.out.println("Successfully added a new appointment!");
break; break;
case "APPOINTMENTS": case "APPOINTMENTS":
......
...@@ -38,6 +38,7 @@ public class Course implements Serializable { ...@@ -38,6 +38,7 @@ public class Course implements Serializable {
System.out.println("SKS: " + sks); System.out.println("SKS: " + sks);
System.out.println("Responsible TA(s):"); System.out.println("Responsible TA(s):");
for (TeachingAssistant ta : teachingAssistants) System.out.println(ta); for (TeachingAssistant ta : teachingAssistants) System.out.println(ta);
System.out.println();
} }
public String getCourseId() { public String getCourseId() {
......
...@@ -29,6 +29,7 @@ public class Admin extends User { ...@@ -29,6 +29,7 @@ public class Admin extends User {
System.out.println("Teaching Assistant " + ta.getUsername() + " has successfully assigned to course " + course.getCourseId()); System.out.println("Teaching Assistant " + ta.getUsername() + " has successfully assigned to course " + course.getCourseId());
course.setTA(ta); course.setTA(ta);
} }
System.out.println();
} }
// Create course // Create course
......
...@@ -33,7 +33,6 @@ public class Student extends UserStudent { ...@@ -33,7 +33,6 @@ public class Student extends UserStudent {
} else{ } else{
Appointment newAppointment = new Appointment(date, this, ta, startTime, endTime, description, status); Appointment newAppointment = new Appointment(date, this, ta, startTime, endTime, description, status);
//this.calendar.addAppointment(day, newAppointment); //this.calendar.addAppointment(day, newAppointment);
System.out.println("Appointment's successfully added");
this.appointmentlist.add(newAppointment); this.appointmentlist.add(newAppointment);
ta.appointmentlist.add(newAppointment); ta.appointmentlist.add(newAppointment);
} }
......
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