Complete code
This commit is contained in:
+20
-3
@@ -70,7 +70,13 @@ public class Main {
|
||||
boolean success;
|
||||
switch (choice) {
|
||||
case 1:
|
||||
//TODO
|
||||
success = school.registerStudent(username, password);
|
||||
if(success){
|
||||
System.out.println(" Student registered successfully!");
|
||||
}
|
||||
else{
|
||||
System.out.println(" Username already exists!");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
success = school.registerTeacher(username, password);
|
||||
@@ -103,7 +109,13 @@ public class Main {
|
||||
|
||||
switch (choice) {
|
||||
case 1:
|
||||
//TODO
|
||||
Student student = school.loginStudent(username, password);
|
||||
if(student != null){
|
||||
studentMenu(student);
|
||||
}
|
||||
else{
|
||||
System.out.println(" Invalid username or password!");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
Teacher teacher = school.loginTeacher(username, password);
|
||||
@@ -153,7 +165,12 @@ public class Main {
|
||||
}
|
||||
|
||||
private static void enrollInCourse(Student student) {
|
||||
//TODO
|
||||
System.out.println("\n Select a course:\n");
|
||||
school.getAllCoursesDisplay();
|
||||
System.out.println();
|
||||
String courseName = scanner.toString();
|
||||
Course course = school.findCourseByName(courseName);
|
||||
student.enrollInCourse(course);
|
||||
}
|
||||
|
||||
// ==================== TEACHER MENU ====================
|
||||
|
||||
Reference in New Issue
Block a user