diff --git a/build.gradle b/build.gradle index cf71005307..a4d964307d 100644 --- a/build.gradle +++ b/build.gradle @@ -13,8 +13,8 @@ repositories { } shadowJar { - archiveBaseName = "mid-v1.1" - archiveVersion = "1.1" + archiveBaseName = "mid" + archiveVersion = "v1.1" archiveClassifier = null archiveAppendix = null } @@ -25,7 +25,7 @@ checkstyle { application { // Change this to your main class. - mainClassName = "src/main/java/duke/Duke" + mainClassName = "duke/Duke" } run { diff --git a/docs/README.md b/docs/README.md index 34aa76fe35..db4f04e83c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,24 +1,96 @@ # Restaurant Manager - User Guide -### 1. Features - -1. **bye:** Exit the program. \[Level-1\] -2. **list:** Show all the tasks. \[Level-2\] -3. **done:** Mark a task as done. \[Level-3\] -4. **todo:** Create a new todo task. \[Level-4\] -5. **deadline:** Create a new deadline task. \[Level-4\] -6. **event:** Create a new event task. \[Level-4\] -7. Handle errors and invalid inputs. \[Level-5\] -8. Load and save tasks to hard disk. \[Level-7\] -9. Identify dates and times. \[Level-8\] -10. **delete:** Delete a task. \[Level-6\] -11. Perform text UI testing. \[A-TestUiTesting\] -12. **find:** Find a task by searching for a keyword. \[Level-9\] -13. Object-oriented. \[A-MoreOOP\] -14. Perform JUnit testing. \[A-JUnit\] -15. Have comments. \[A-JavaDoc\] - -### 2. Command Summary +1. Introduction +2. Quick Start +3. Features + - bye: Exit the program. [Level-1] + - list: Show all the tasks. [Level-2] + - done: Mark a task as done. [Level-3] + - todo: Create a new todo task. [Level-4] + - deadline: Create a new deadline task. [Level-4] + - event: Create a new event task. [Level-4] + - Handle errors and invalid inputs. [Level-5] + - Load and save tasks to hard disk. [Level-7] + - Identify dates and times. [Level-8] + - delete: Delete a task. [Level-6] + - Perform text UI testing. [A-TestUiTesting] + - find: Find a task by searching for a keyword. [Level-9] + - Object-oriented. [A-MoreOOP] + - Perform JUnit testing. [A-JUnit] + - Have comments. [A-JavaDoc] +4. Command Summary + +## 1. Introduction + +Duke is targeted towards restaurant chefs who wants to be able to consolidate most of the things happening in their kitchen such as recipes, ingredients, expiry dates etc. + +## 2. Quick Start + +1. Ensure you have Java `11` or above installed in your Computer. + +2. Download the latest Duke.jar [here](https://github.com/AY1920S1-CS2113-T14-2/main/releases). + +3. Copy the file to the folder you want to use as the home folder for your Duke application. + +4. Double-click the file to start the app. The GUI should appear in a few seconds. + + ![UI](https://github.com/9hafidz6/main/blob/master/docs/images/UI.png) + +5. Type into the INPUT box some commands and press ENTER to execute + +6. Some example commands + + 1. **list**: lists out all the tasks + 2. **deadline** prepare new recipe **/by** 1/1/2019: adds a deadline task "prepare new recipe" into your list by "1/1/2019" + 3. **bye**: exits the program + +7. Refer to Section 4 for the full list of features + +## 3. Features + +### 3.1 bye: Exit the program. [Level-1] + +Saves data onto local storage and exits the program + +Format: `bye` + +### 3.2 list: Show all the tasks. [Level-2] + +Shows all the task marked done/undone to the user + +Format: `list` + +### 3.3 done: Mark a task as done. [Level-3] + +marks a task in list as done. + +Format + +### 3.4 todo: Create a new todo task. [Level-4] + +### 3.5 deadline: Create a new deadline task. [Level-4] + +### 3.6 event: Create a new event task. [Level-4] + +### 3.7 Handle errors and invalid inputs. [Level-5] + +### 3.8 Load and save tasks to hard disk. [Level-7] + +### 3.9 Identify dates and times. [Level-8] + +### 3.10 delete: Delete a task. [Level-6] + +### 3.11 Perform text UI testing. [A-TestUiTesting] + +### 3.12 find: Find a task by searching for a keyword. [Level-9] + +### 3.13 Object-oriented. [A-MoreOOP] + +### 3.14 Perform JUnit testing. [A-JUnit] + +### 3.15 Have comments. [A-JavaDoc] + +## 4. Command Summary Index | Keyword | Usage ----- | -------- | ---------- @@ -29,4 +101,5 @@ Index | Keyword | Usage 5 | deadline | deadline \ /by \ 6 | event | event \ /at \ 7 | delete | delete \ -8 | find | find \ \ No newline at end of file +8 | find | find \ +9 | remind | remind \ No newline at end of file diff --git a/docs/images/UI.png b/docs/images/UI.png new file mode 100644 index 0000000000..bfa5998e06 Binary files /dev/null and b/docs/images/UI.png differ diff --git a/src/main/.gradle/5.2.1/executionHistory/executionHistory.bin b/src/main/.gradle/5.2.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000000..91e999e2e1 Binary files /dev/null and b/src/main/.gradle/5.2.1/executionHistory/executionHistory.bin differ diff --git a/src/main/.gradle/5.2.1/executionHistory/executionHistory.lock b/src/main/.gradle/5.2.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000000..cc7a41df70 Binary files /dev/null and b/src/main/.gradle/5.2.1/executionHistory/executionHistory.lock differ diff --git a/src/main/.gradle/5.2.1/fileChanges/last-build.bin b/src/main/.gradle/5.2.1/fileChanges/last-build.bin new file mode 100644 index 0000000000..f76dd238ad Binary files /dev/null and b/src/main/.gradle/5.2.1/fileChanges/last-build.bin differ diff --git a/src/main/.gradle/5.2.1/fileContent/fileContent.lock b/src/main/.gradle/5.2.1/fileContent/fileContent.lock new file mode 100644 index 0000000000..84bd70d10f Binary files /dev/null and b/src/main/.gradle/5.2.1/fileContent/fileContent.lock differ diff --git a/src/main/.gradle/5.2.1/fileHashes/fileHashes.bin b/src/main/.gradle/5.2.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000000..e7830143cf Binary files /dev/null and b/src/main/.gradle/5.2.1/fileHashes/fileHashes.bin differ diff --git a/src/main/.gradle/5.2.1/fileHashes/fileHashes.lock b/src/main/.gradle/5.2.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000000..dddbed8a8b Binary files /dev/null and b/src/main/.gradle/5.2.1/fileHashes/fileHashes.lock differ diff --git a/src/main/.gradle/5.2.1/gc.properties b/src/main/.gradle/5.2.1/gc.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/main/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/src/main/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000000..0df6115664 Binary files /dev/null and b/src/main/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/src/main/.gradle/buildOutputCleanup/cache.properties b/src/main/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000000..896885090d --- /dev/null +++ b/src/main/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Thu Sep 26 21:58:55 SGT 2019 +gradle.version=5.2.1 diff --git a/src/main/.gradle/buildOutputCleanup/outputFiles.bin b/src/main/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000000..1adcbe63d3 Binary files /dev/null and b/src/main/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/src/main/.gradle/vcs-1/gc.properties b/src/main/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/main/.idea/$PRODUCT_WORKSPACE_FILE$ b/src/main/.idea/$PRODUCT_WORKSPACE_FILE$ new file mode 100644 index 0000000000..67bd976742 --- /dev/null +++ b/src/main/.idea/$PRODUCT_WORKSPACE_FILE$ @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/.idea/libraries/gradle_wrapper.xml b/src/main/.idea/libraries/gradle_wrapper.xml new file mode 100644 index 0000000000..0796d76606 --- /dev/null +++ b/src/main/.idea/libraries/gradle_wrapper.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/.idea/misc.xml b/src/main/.idea/misc.xml new file mode 100644 index 0000000000..1763e153b6 --- /dev/null +++ b/src/main/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/.idea/modules.xml b/src/main/.idea/modules.xml new file mode 100644 index 0000000000..122a9054e1 --- /dev/null +++ b/src/main/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/.idea/vcs.xml b/src/main/.idea/vcs.xml new file mode 100644 index 0000000000..b2bdec2d71 --- /dev/null +++ b/src/main/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/.idea/workspace.xml b/src/main/.idea/workspace.xml new file mode 100644 index 0000000000..0d9822c1a5 --- /dev/null +++ b/src/main/.idea/workspace.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1569506663454 + + + + + + + \ No newline at end of file diff --git a/src/main/gradle/wrapper/gradle-wrapper.jar b/src/main/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..87b738cbd0 Binary files /dev/null and b/src/main/gradle/wrapper/gradle-wrapper.jar differ diff --git a/src/main/gradle/wrapper/gradle-wrapper.properties b/src/main/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..44e7c4d1d7 --- /dev/null +++ b/src/main/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/src/main/java/duke/Duke.java b/src/main/java/duke/Duke.java index cb92632d7e..ead6a06c67 100644 --- a/src/main/java/duke/Duke.java +++ b/src/main/java/duke/Duke.java @@ -34,7 +34,7 @@ public Duke(String filePath) { /** * The execution core of the Duke class. */ - public void run() { + public void run() throws DukeException { ui.showWelcome(); boolean isExit = false; while (!isExit) { @@ -55,8 +55,8 @@ public void run() { /** * =============== MAIN FUNCTION ===============. */ - public static void main(String[] args) { + public static void main(String[] args) throws DukeException { new Duke("data/tasks.txt").run(); + } } - diff --git a/src/main/java/duke/command/RemindCommand.java b/src/main/java/duke/command/RemindCommand.java new file mode 100644 index 0000000000..57534afaf5 --- /dev/null +++ b/src/main/java/duke/command/RemindCommand.java @@ -0,0 +1,51 @@ +package duke.command; + +import duke.exception.DukeException; +import duke.storage.Storage; +import duke.task.TaskList; +import duke.ui.Ui; + +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.Date; + +public class RemindCommand extends Command{ + + public RemindCommand() { + + } + + @Override + public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException{ + try { + int num = 1; + LocalDate date = LocalDate.now(); + LocalDate endDate = date.plusDays(5); + + Date StartDate = Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()); + Date EndDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); + + if(taskList.size() == 0) { + System.out.println("You have no upcoming events/deadlines/todos"); + } + else { + System.out.println("These are your Tasks in the next 5 days"); + for(int a = 0; a < taskList.size(); a++) { + Date TaskDate = taskList.getTask(a).getCurrentDate(); + + if((isWithinRange(TaskDate, EndDate, StartDate))) { + System.out.println(num + ": " + taskList.getTask(a).toString()); + num++; + } + } + } + } catch ( Exception e) { + // + } + + } + + private boolean isWithinRange(Date TaskDate, Date EndDate, Date StartDate) { + return TaskDate.before(EndDate) && TaskDate.after(StartDate); + } +} diff --git a/src/main/java/duke/parser/Parser.java b/src/main/java/duke/parser/Parser.java index 426eef36c1..860ef23617 100644 --- a/src/main/java/duke/parser/Parser.java +++ b/src/main/java/duke/parser/Parser.java @@ -65,8 +65,14 @@ public static Command parse(String fullCommand, int size) throws DukeException { checkLength(splitted); return new FindCommand(splitted[1]); case "delete": - checkLength(splitted); - return new DeleteCommand(checkNumber(splitted[1], size)); + if (splitted.length == 2) { + int taskNb = Integer.parseInt(splitted[1]); + return new DeleteCommand(taskNb - 1); + } else throw new DukeException("Need a task number after done!"); + case "remind": + if (splitted.length == 1) { + return new RemindCommand(); + }else throw new DukeException("no parameters after 'remind'"); case "snooze": checkLength(splitted); String[] getUntil = splitAndCheck(splitted[1], " /until ");