diff --git a/README.md b/README.md index 9d95025bce..501854eff8 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,93 @@ -# Duke project template - -This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it. - -## Setting up in Intellij - -Prerequisites: JDK 11, update Intellij to the most recent version. - -1. Open Intellij (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project dialog first) -1. Set up the correct JDK version, as follows: - 1. Click `Configure` > `Structure for New Projects` and then `Project Settings` > `Project` > `Project SDK` - 1. If JDK 11 is listed in the drop down, select it. If it is not, click `New...` and select the directory where you installed JDK 11 - 1. Click `OK` -1. Import the project into Intellij as follows: - 1. Click `Open or Import`. - 1. Select the project directory, and click `OK` - 1. If there are any further prompts, accept the defaults. -1. After the importing is complete, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()`. If the setup is correct, you should see something like the below: - ``` - Hello from - ____ _ - | _ \ _ _| | _____ - | | | | | | | |/ / _ \ - | |_| | |_| | < __/ - |____/ \__,_|_|\_\___| - ``` +# User Guide + + + +## Starting Duke program + +### Using Command Line + +2. Open Command Prompt (on Windows) or Terminal (on Mac) +3. Change directory to the folder where `ip.jar` file are stored by `cd` into `ip\out\artifacts\ip_jar` +4. Change the font in Command Prompt to NSimSan by typing `chcp 65001` in Command Prompt +6. Type in `java -Dfile.encoding=UTF-8 -jar ip.jar`, then enter to run Duke. + + + + +## Viewing possible actions: `help` +Format `help` + +## Adding a task to Duke: `todo` `event` `deadline` +Words in `UPPERCASE` are the parameters + +### Adding a Todo: `todo` +Adds a Todo to the Duke + +_Format_: `todo DESCRIPTION` + +__Example:__ + +- `todo borrow The kite runner` +- `todo return the pen get from Jen` + +### Adding an Event +Adds an Event to the Duke + +_Format_: `event DESCRIPTION /at YYYY-MM-DD HH:MM` + +__Example:__ + +- `event project meeting /at 2020-09-23 12:00` +- `event join the BumbleBee Welcome Tea /at 2020-09-23 12:00` + +### Adding a Deadline +Adds a Deadline to the Duke + +_Format_: `deadline DESCRIPTION /by YYYY-MM-DD HH:MM` + +__Example:__ + +- `deadline project report /by 2020-09-23 12:00` +- `deadline join the BumbleBee First Evaluation /by 2020-09-23 12:00` + +## Listing all tasks: `list` +Shows a list of all tasks in Duke, along with their details, status and ID + +_Format_: `list` + +## Marking task as done: `done` +Marks a task specified by its ID as done. You have to list all the tasks first using `list` before using `done` + +_Format_: `done ID` + +__Example__: + +- `list` `done 1`: will mark the first task in the last shown list as done +- `list` `done 3`: will mark the third task in the last shown list as done + +## Deleting task: `delete` +Deletes a task specified by its ID. You have to list all the tasks first using `list` before using `delete` + +_Format_: `delete ID` + +__Example__: + +- `list` `delete 1`: will delete the first task in the last shown list +- `list` `delete 3`: will delete the third task in the last shown list + +## Find task: `find` +Finds tasks containing a given keyword + +_Format:_ `find KEYWORD` + +__Example:__: + +- `find book`: will return all tasks having _book_ in their description +- `find project`: will return all tasks having _project_ in their description + +## Exiting the program: `bye` +Exits the Duke + +_Format:_ `bye` + + diff --git a/data/duke.txt b/data/duke.txt new file mode 100644 index 0000000000..6fbc88a894 --- /dev/null +++ b/data/duke.txt @@ -0,0 +1,4 @@ +[T][✘] join sports club[T][✘] read book[D][✘] return book (by: June 6th)[E][✘] project meeting (at: Aug 6th 2-4pm)[T][✘] read book +[D][✘] return book (by: June 6th) +[E][✘] project meeting (at: Aug 6th 2-4pm) +[T][✘] join sports club diff --git a/duke.txt b/duke.txt new file mode 100644 index 0000000000..419f34c07b --- /dev/null +++ b/duke.txt @@ -0,0 +1,5 @@ +T | 0 | read book +E | 0 | project meeting | 2020-11-13 19:00 +T | 0 | borrow book +D | 0 | return book | 2020-11-24 03:00 +E | 0 | project meeting | 2020-09-23 12:00 diff --git a/null b/null new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java deleted file mode 100644 index 5d313334cc..0000000000 --- a/src/main/java/Duke.java +++ /dev/null @@ -1,10 +0,0 @@ -public class Duke { - public static void main(String[] args) { - String logo = " ____ _ \n" - + "| _ \\ _ _| | _____ \n" - + "| | | | | | | |/ / _ \\\n" - + "| |_| | |_| | < __/\n" - + "|____/ \\__,_|_|\\_\\___|\n"; - System.out.println("Hello from\n" + logo); - } -} diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..2c9a9745c5 --- /dev/null +++ b/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: duke.Duke + diff --git a/src/main/java/duke/Duke.java b/src/main/java/duke/Duke.java new file mode 100644 index 0000000000..749e13975b --- /dev/null +++ b/src/main/java/duke/Duke.java @@ -0,0 +1,74 @@ +package duke; + +import duke.action.Action; +import duke.action.ActionResult; +import duke.action.ExitAction; +import duke.exception.DukeException; +import duke.parser.Parser; +import duke.storage.Storage; +import duke.task.TaskManager; +import duke.ui.TextUi; + +public class Duke { + + private TaskManager todayList; + private TextUi ui; + private String filePath = "duke.txt"; + private Storage storage; + + public static void main(String[] args) { + new Duke().run(); + } + + /** + * Runs the program until termination. + */ + public void run() { + loadData(); + start(); + runCommandLoopUntilExitCommand(); + exit(); + } + + private void loadData() { + storage = new Storage(filePath); + try { + todayList = storage.loadFromStorage(); + } catch (DukeException e) { + todayList = new TaskManager(); + } + } + + private void start() { + this.ui = new TextUi(); + ui.printWelcomeMessage(); + } + + private void exit() { + ui.printGoodbyeMessage(); + System.exit(0); + } + + private void runCommandLoopUntilExitCommand() { + Action action; + do { + String userInput = ui.getUserInput(); + action = new Parser().parseInput(userInput); + ActionResult result = executeCommand(action); + action.modifyFile(); + ui.printActionResult(result); + } while (!ExitAction.isExit(action)); + } + + private ActionResult executeCommand(Action action) { + try { + action.setData(todayList); + ActionResult result = action.executeAction(); + return result; + } catch (Exception e) { + ui.printScreen(e.getMessage()); + throw new RuntimeException(e); + } + } +} + diff --git a/src/main/java/duke/action/Action.java b/src/main/java/duke/action/Action.java new file mode 100644 index 0000000000..e2f9a0a44b --- /dev/null +++ b/src/main/java/duke/action/Action.java @@ -0,0 +1,46 @@ +package duke.action; + +import duke.exception.DukeException; +import duke.storage.Storage; +import duke.task.TaskManager; +import java.nio.file.Paths; + +public class Action { + protected TaskManager taskList; + private int taskID = -1; + + protected Action() { + } + + /** + * Executes the action and returns the result. + */ + public ActionResult executeAction() { + throw new UnsupportedOperationException("To be implemented by child classes"); + } + + /** + * Supplies the data the action will be executed on. + */ + public void setData(TaskManager taskList) { + this.taskList = taskList; + } + + /** + * Extracts the task with target taskID in the last shown list + */ + public int getTargetIndex() { + return taskID; + } + + /** + * modifies the default Storage file (duke.txt) whenever an action is executed + */ + public void modifyFile() { + try { + Storage.saveToStorage(taskList, Paths.get(Storage.DEFAULT_STORAGE_FILEPATH)); + } catch (DukeException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/duke/action/ActionResult.java b/src/main/java/duke/action/ActionResult.java new file mode 100644 index 0000000000..5fe8c58696 --- /dev/null +++ b/src/main/java/duke/action/ActionResult.java @@ -0,0 +1,16 @@ +package duke.action; + +public class ActionResult { + + public final String outputToScreen; + + /** + * constructs the ActionResult class + * + * @param outputToScreen a String to be printed out to the user as a result of an action + */ + public ActionResult(String outputToScreen) { + this.outputToScreen = outputToScreen; + } + +} diff --git a/src/main/java/duke/action/AddAction.java b/src/main/java/duke/action/AddAction.java new file mode 100644 index 0000000000..c3812c3e31 --- /dev/null +++ b/src/main/java/duke/action/AddAction.java @@ -0,0 +1,9 @@ +package duke.action; + +public abstract class AddAction extends Action { + public static final String MESSAGE = "Got it. I've added this task:\n %1$s\n" + + "Now you have %2$d tasks in the list."; + + public abstract ActionResult executeAction(); + +} diff --git a/src/main/java/duke/action/AddDeadline.java b/src/main/java/duke/action/AddDeadline.java new file mode 100644 index 0000000000..79d752a61f --- /dev/null +++ b/src/main/java/duke/action/AddDeadline.java @@ -0,0 +1,28 @@ +package duke.action; + +import duke.task.Deadline; +import duke.task.Task; + +import java.time.LocalDateTime; + +/** + * Adds a Deadline task to the TaskManager. + */ +public class AddDeadline extends AddAction{ + public static final String ACTION = "deadline"; + public static final String HELP_MESSAGE = ACTION + ": Adds a Deadline to the task list of DUKE.\n" + + " Parameters: DESCRIPTION /by YYYY-MM-DD HH:MM\n" + + " Example: " + ACTION + + " submit the third Math homework /by 2020-10-03 23:59"; + public static Task task; + + public AddDeadline(String description, LocalDateTime byTime) { + task = new Deadline(description, getTargetIndex(), byTime); + } + + @Override + public ActionResult executeAction() { + taskList.addTask(task); + return new ActionResult(String.format(MESSAGE, task, taskList.getNumTasks())); + } +} diff --git a/src/main/java/duke/action/AddEvent.java b/src/main/java/duke/action/AddEvent.java new file mode 100644 index 0000000000..99d65b311b --- /dev/null +++ b/src/main/java/duke/action/AddEvent.java @@ -0,0 +1,29 @@ +package duke.action; + +import duke.task.Event; +import duke.task.Task; + +import java.time.LocalDateTime; + +/** + * Adds an Event task to the TaskManager. + */ +public class AddEvent extends AddAction { + public static final String ACTION = "event"; + public static Task task; + public static final String HELP_MESSAGE = ACTION + ": Adds an Event to the task list of DUKE.\n" + + " Parameters: DESCRIPTION /at YYYY-MM-DD HH:MM\n" + + " Example: " + ACTION + + " meet with the CS2113 team /at 2020-10-12 16:00"; + + public AddEvent(String description, LocalDateTime atTime) { + task = new Event(description, getTargetIndex(), atTime); + } + + @Override + public ActionResult executeAction() { + taskList.addTask(task); + return new ActionResult(String.format(MESSAGE, task, taskList.getNumTasks())); + } + +} diff --git a/src/main/java/duke/action/AddTodo.java b/src/main/java/duke/action/AddTodo.java new file mode 100644 index 0000000000..4a232b9404 --- /dev/null +++ b/src/main/java/duke/action/AddTodo.java @@ -0,0 +1,27 @@ +package duke.action; + +import duke.task.Task; +import duke.task.ToDo; + +/** + * Adds a Todo task to the TaskManager. + */ +public class AddTodo extends AddAction { + public static final String ACTION = "todo"; + public static final String HELP_MESSAGE = ACTION + ": Adds a Todo to the task list of DUKE.\n" + + " Parameters: DESCRIPTION\n" + + " Example: " + ACTION + + " return books to the Library"; + public static Task task; + + public AddTodo(String description) { + task = new ToDo(description, getTargetIndex()); + } + + @Override + public ActionResult executeAction() { + taskList.addTask(task); + return new ActionResult(String.format(MESSAGE, task, taskList.getNumTasks())); + + } +} diff --git a/src/main/java/duke/action/DeleteAction.java b/src/main/java/duke/action/DeleteAction.java new file mode 100644 index 0000000000..f217b992f5 --- /dev/null +++ b/src/main/java/duke/action/DeleteAction.java @@ -0,0 +1,29 @@ +package duke.action; + +import duke.task.Task; + +/** + * Deletes a task identified using it's last displayed index from the TaskManager. + */ +public class DeleteAction extends Action { + public static final String ACTION = "delete"; + public static final String HELP_MESSAGE = ACTION + + ": Deletes the task identified by the index number.\n" + + " Parameters: INDEX\n" + + " Example: " + ACTION + " 1"; + private int taskID; + + public static final String MESSAGE = "Noted down. I've deleted this task:\n %1$s\n" + + "Now you have %2$d tasks in the list.";; + + public DeleteAction(int taskID) { + this.taskID = taskID; + } + + @Override + public ActionResult executeAction() { + final Task deletedTask = taskList.getTask(taskID); + taskList.deleteTask(this.taskID); + return new ActionResult(String.format(MESSAGE, deletedTask, taskList.getNumTasks())); + } +} diff --git a/src/main/java/duke/action/ExitAction.java b/src/main/java/duke/action/ExitAction.java new file mode 100644 index 0000000000..6ba166395b --- /dev/null +++ b/src/main/java/duke/action/ExitAction.java @@ -0,0 +1,20 @@ +package duke.action; + +/** + * Exits the Duke + */ +public class ExitAction extends Action{ + public static final String ACTION = "bye"; + + public static final String HELP_MESSAGE = ACTION + ": Exits the program.\n" + + " Example: " + ACTION; + public static final String EXIT_MESSAGE = "I am closing today's task list ..."; + + public ActionResult executeAction() { + return new ActionResult(EXIT_MESSAGE); + } + + public static boolean isExit(Action action) { + return action instanceof ExitAction; // instanceof returns false if it is null + } +} diff --git a/src/main/java/duke/action/FindAction.java b/src/main/java/duke/action/FindAction.java new file mode 100644 index 0000000000..72dd2b4789 --- /dev/null +++ b/src/main/java/duke/action/FindAction.java @@ -0,0 +1,45 @@ +package duke.action; + +/** + * Finds tasks containing a given keyword (not empty) + */ +public class FindAction extends Action { + public static final String ACTION = "find"; + + public static final String HELP_MESSAGE = ACTION + ": Finds all tasks whose descriptions contain any of " + + "a keyword and displays them as a list with index numbers.\n" + + " Parameters: KEYWORD\n" + + " Example: " + ACTION + "book"; + + public static final String MESSAGE = "Here are the matching tasks in your list:\n%1$s" + + "%2$d matching tasks listed!"; + public static final String NO_TASk_FOUND_MESSAGE = "No matching tasks found!"; + public int numberOfMactchingTasks; + + public String keyword; + + public FindAction(String keyword) { + this.keyword = keyword; + this.numberOfMactchingTasks = 0; + } + + public String getStringOfMatchingTask() { + String matchingTask = ""; + for (int i = 0; i tasks = new ArrayList(); + + /** + * Adds a Task object to the ArrayList of Tasks + */ + public void addTask(Task task) { + tasks.add(task); + } + + /** + * gets the total number of tasks + * + * @return integer primitive type number of tasks + */ + public int getNumTasks() { + return tasks.size(); + } + + /** + * deletes task specified by its ID in the last shown list + * @param taskID + */ + public void deleteTask(int taskID) { + tasks.remove(taskID-INDEX_OFFSET); + } + + /** + * gets the tasks specified by their index in form of String + * + * @param id task index + * @return a String of task + */ + public String getStringOfTask(int id) { + return tasks.get(id).toString(); + } + + /** + * gets all tasks in the list in form of concatenated String + * + * @return a String of all tasks + */ + public String getStringOfAllTasks() { + String stringOfTasks = ""; + for (int i = 0; i getAllTasks() { + return tasks; + } + + /** + * set Task specified by its index as Done + * + * @param id integer primitive type + */ + public void setTaskAsDone(int id) { + tasks.get(id).setAsDone(); + } + +} diff --git a/src/main/java/duke/task/ToDo.java b/src/main/java/duke/task/ToDo.java new file mode 100644 index 0000000000..15670b5791 --- /dev/null +++ b/src/main/java/duke/task/ToDo.java @@ -0,0 +1,19 @@ +package duke.task; + +import duke.task.Task; + +public class ToDo extends Task { + public ToDo(String description, int taskID) { + super(description, taskID); + } + + @Override + public String toFile() { + return String.format("T | %s | %s", getStatusAsNumber(), description); + } + + @Override + public String toString() { + return String.format("[T]%s %s", getStatus(), description); + } +} diff --git a/src/main/java/duke/ui/TextUi.java b/src/main/java/duke/ui/TextUi.java new file mode 100644 index 0000000000..345abce135 --- /dev/null +++ b/src/main/java/duke/ui/TextUi.java @@ -0,0 +1,47 @@ +package duke.ui; + +import duke.action.ActionResult; + +import java.util.Scanner; + +import static duke.message.Messages.GOODBYE_MESSAGE; +import static duke.message.Messages.WELCOME_MESSAGE; +import static duke.message.Messages.LOGO_MESSAGE; + +public class TextUi { + + public static final int INDEX_OFFSET = 1; + + private static final String REPLY_IDENTIFIER = ">> "; + private static final String NEWLINE = System.lineSeparator(); + private static final String COMMAND_DIVIDER = "==================================================="; + + public String getUserInput() { + System.out.print(REPLY_IDENTIFIER + "Action: "); + Scanner sc = new Scanner(System.in); + String UserInput = sc.nextLine(); + return UserInput; + } + + public void printWelcomeMessage() { + printScreen(COMMAND_DIVIDER, COMMAND_DIVIDER, LOGO_MESSAGE, COMMAND_DIVIDER, WELCOME_MESSAGE); + } + + public void printGoodbyeMessage() { + printScreen(GOODBYE_MESSAGE, COMMAND_DIVIDER, COMMAND_DIVIDER); + } + + public void printScreen(String... messages) { + for (String message: messages) { + if (message == LOGO_MESSAGE || message == COMMAND_DIVIDER) { + System.out.println(message); + } else { + System.out.println(REPLY_IDENTIFIER + message.replace("\n", NEWLINE + REPLY_IDENTIFIER)); + } + } + } + + public void printActionResult(ActionResult result) { + printScreen(result.outputToScreen, COMMAND_DIVIDER); + } +} diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT index 657e74f6e7..0ba57e472b 100644 --- a/text-ui-test/EXPECTED.TXT +++ b/text-ui-test/EXPECTED.TXT @@ -1,7 +1,128 @@ -Hello from - ____ _ -| _ \ _ _| | _____ +=================================================== +=================================================== + ____ _ +| _ \ _ _| | _____ | | | | | | | |/ / _ \ | |_| | |_| | < __/ |____/ \__,_|_|\_\___| +=================================================== +>> Hello! I'm Duke. +>> What do you want to do today? +>> Action: +>> Got it. I've added this task: +>> [T][✘] read book +>> Now you have 1 tasks in the list. +=================================================== +>> Action: help +>> todo: Adds a Todo to the task list of DUKE. +>> Parameters: DESCRIPTION +>> Example: todo return books to the Library +>> event: Adds an Event to the task list of DUKE. +>> Parameters: DESCRIPTION /at YYYY-MM-DD HH:MM +>> Example: event meet with the CS2113 team /at 2020-10-12 16:00 +>> deadline: Adds a Deadline to the task list of DUKE. +>> Parameters: DESCRIPTION /by YYYY-MM-DD HH:MM +>> Example: deadline submit the third Math homework /by 2020-10-03 23:59 +>> delete: Deletes the task identified by the index number. +>> Parameters: INDEX +>> Example: delete 1 +>> list: Displays all tasks in DUKE as a list with index numbers. +>> Example: list +>> help: Shows what you can do in DUKE. +>> Example: help +>> bye: Exits the program. +>> Example: bye +=================================================== +>> Action: +>> Got it. I've added this task: +>> [D][✘] return book (by: Oct 12 2020 16:00) +>> Now you have 2 tasks in the list. +=================================================== +>> Action: +>> Got it. I've added this task: +>> [E][✘] project meeting (at: Nov 13 2020 19:00) +>> Now you have 3 tasks in the list. +=================================================== +>> Action: +>> Got it. I've added this task: +>> [T][✘] join sports club +>> Now you have 4 tasks in the list. +=================================================== +>> Action: +>> Got it. I've added this task: +>> [T][✘] borrow book +>> Now you have 5 tasks in the list. +=================================================== +>> Action: +>> Here are the tasks in your list: +>> 1. [T][✘] read book +>> 2. [D][✘] return book (by: Oct 12 2020 16:00) +>> 3. [E][✘] project meeting (at: Nov 13 2020 19:00) +>> 4. [T][✘] join sports club +>> 5. [T][✘] borrow book +>> You have 5 tasks in the list +=================================================== +>> Action: +>> Got it. I've added this task: +>> [D][✘] return book (by: Nov 24 2020 03:00) +>> Now you have 6 tasks in the list. +=================================================== +>> Action: +>> Got it. I've added this task: +>> [E][✘] project meeting (at: Sep 23 2020 12:00) +>> Now you have 7 tasks in the list. +=================================================== +>> Action: +>> Here are the tasks in your list: +>> 1. [T][✘] read book +>> 2. [D][✘] return book (by: Oct 12 2020 16:00) +>> 3. [E][✘] project meeting (at: Nov 13 2020 19:00) +>> 4. [T][✘] join sports club +>> 5. [T][✘] borrow book +>> 6. [D][✘] return book (by: Nov 24 2020 03:00) +>> 7. [E][✘] project meeting (at: Sep 23 2020 12:00) +>> You have 7 tasks in the list +=================================================== +>> Action: +>> Noted down. I've deleted this task: +>> [D][✘] return book (by: Oct 12 2020 16:00) +>> Now you have 6 tasks in the list. +=================================================== +>> Action: +>> Here are the tasks in your list: +>> 1. [T][✘] read book +>> 2. [E][✘] project meeting (at: Nov 13 2020 19:00) +>> 3. [T][✘] join sports club +>> 4. [T][✘] borrow book +>> 5. [D][✘] return book (by: Nov 24 2020 03:00) +>> 6. [E][✘] project meeting (at: Sep 23 2020 12:00) +>> You have 6 tasks in the list +=================================================== +>> Action: +>> Noted down. I've deleted this task: +>> [T][✘] join sports club +>> Now you have 5 tasks in the list. +=================================================== +>> Action: +>> Here are the tasks in your list: +>> 1. [T][✘] read book +>> 2. [E][✘] project meeting (at: Nov 13 2020 19:00) +>> 3. [T][✘] borrow book +>> 4. [D][✘] return book (by: Nov 24 2020 03:00) +>> 5. [E][✘] project meeting (at: Sep 23 2020 12:00) +>> You have 5 tasks in the list +=================================================== +>> Action: +>> Here are the matching tasks in your list: +>> 1. [T][✘] read book +>> 3. [T][✘] borrow book +>> 4. [D][✘] return book (by: Nov 24 2020 03:00) +>> 3 matching tasks listed! +=================================================== +>> Action: +>> I am closing today's task list ... +=================================================== +>> Good bye. See you tomorrow! +=================================================== +=================================================== \ No newline at end of file diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt index e69de29bb2..a8178fa6cd 100644 --- a/text-ui-test/input.txt +++ b/text-ui-test/input.txt @@ -0,0 +1,15 @@ +todo read book +help +deadline return book /by 2020-10-12 16:00 +event project meeting /at 2020-11-13 19:00 +todo join sports club +todo borrow book +list +deadline return book /by 2020-11-24 03:00 +event project meeting /at 2020-09-23 12:00 +list +delete 2 +delete 3 +list +find book +bye \ No newline at end of file diff --git a/text-ui-test/runtest.bat b/text-ui-test/runtest.bat index d0facc6310..fc7f7e7e51 100644 --- a/text-ui-test/runtest.bat +++ b/text-ui-test/runtest.bat @@ -4,10 +4,10 @@ REM create bin directory if it doesn't exist if not exist ..\bin mkdir ..\bin REM delete output from previous run -del ACTUAL.TXT +DEL ACTUAL.TXT REM compile the code into the bin folder -javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\Duke.java +javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\duke\Duke.java ..\src\main\java\duke\action\*.java ..\src\main\java\duke\exception\*.java ..\src\main\java\duke\message\*.java ..\src\main\java\duke\parser\*.java ..\src\main\java\duke\storage\*.java ..\src\main\java\duke\task\*.java ..\src\main\java\duke\ui\*.java IF ERRORLEVEL 1 ( echo ********** BUILD FAILURE ********** exit /b 1 @@ -15,7 +15,7 @@ IF ERRORLEVEL 1 ( REM no error here, errorlevel == 0 REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT -java -classpath ..\bin Duke < input.txt > ACTUAL.TXT +java -Dfile.encoding=UTF-8 -classpath ..\bin\duke Duke < input.txt > ACTUAL.TXT REM compare the output to the expected output FC ACTUAL.TXT EXPECTED.TXT