Skip to content

Commit 4d8184d

Browse files
authored
Merge pull request nus-cs2113-AY2324S1#28 from Brian030601/master
Improve Calendar & Flashcard Integration
2 parents f3d5405 + 8fea1da commit 4d8184d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/main/java/seedu/duke/Duke.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,34 @@ private void runCalendar() {
3333
System.out.println("Bye bye");
3434
break;
3535
} else if (input.equals("flashcard")) {
36+
System.out.println(" Switched to flashcard functions");
3637
runFlashcard();
3738
} else if (manager.validCommand(input)) {
3839
manager.startCalendar(input);
3940
} else {
4041
System.out.println("Invalid command! Enter a valid command.");
4142
}
42-
4343
}
44-
4544
}
4645

4746
private void runFlashcard() {
48-
System.out.print("Enter your command: ");
49-
5047
FlashcardComponent fc = new FlashcardComponent(new ArrayList<Flashcard>());
5148

5249
Scanner scanner = new Scanner(System.in);
5350
String input;
5451
boolean shouldTerminate = false;
5552

53+
System.out.print("Enter your command: ");
5654
while (!shouldTerminate) {
5755
input = scanner.nextLine();
5856

59-
if (fc.isResponsible(input)) {
57+
if (input.equals("end program")) {
58+
System.out.println("Bye bye");
59+
break;
60+
} else if (input.equals("calendar")) {
61+
System.out.println(" Switched to calendar functions");
62+
runCalendar();
63+
} else if (fc.isResponsible(input)) {
6064
fc.processInput(input);
6165
} else {
6266
System.out.println(" Invalid command! Sorry; please try again.");

0 commit comments

Comments
 (0)