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