Skip to content

Commit

Permalink
updated Ui and Duke classes; updated JavaDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
brandoncjh committed Mar 1, 2020
1 parent c5c8c30 commit 1f60457
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/data/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public void runExit() {
ui.displayMessage(SAVE_TASKLIST_TO_FILE_FAILURE_MESSAGE);
}

ui.closeScanner();
ui.sayGoodbye();
System.exit(0);
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.PrintStream;
import java.util.Scanner;
import common.Messages;
import data.Duke;

import static common.Messages.START_MESSAGE;
import static common.Messages.FIRST_EXIT_MESSAGE;
Expand Down Expand Up @@ -67,6 +68,14 @@ public String getUserCommand() {
return userInput;
}

/**
* This method closes the Scanner object.
* Is used only when Duke executes {@link Duke#runExit()}
*/
public void closeScanner() {
this.in.close();
}

/**
* This methods prints out the message input, enclosed within underscored borders, for user to view.
* @param message the message to be printed
Expand Down

0 comments on commit 1f60457

Please sign in to comment.