diff --git a/data/tasks.txt b/data/tasks.txt index 522f25df..b18f9405 100644 --- a/data/tasks.txt +++ b/data/tasks.txt @@ -1,3 +1,5 @@ T|1|read book D|1|return book|09/09/09 2359 E|0|meeting|here +T|0|test 09/09/09 +T|0|test1 16/10/2019 diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 4f0b5fbd..36a5b476 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -44,7 +44,7 @@ #### 2.1 Architecture -![architecture](https://github.com/9hafidz6/main/blob/master/docs/images/architecture.png) +![architecture](https://github.com/9hafidz6/main/blob/master/docs/images/architectureV1.1.png) `main` has 1 class called `Duke`. It is responsible for, @@ -61,6 +61,8 @@ The Application consist of 6 other components - `task`: stores a list of deadline/event/todo that needs to be done - `ui`: The UI of the application +![sequence](https://github.com/9hafidz6/main/blob/master/docs/images/UMLsequence.png) + #### 2.2 UI @@ -152,8 +154,7 @@ Target user profile: Restaurant Chef | Priority | As a ... | I want to ... | So that ... | | -------- | ------------------ | ------------------------------------------------------------ | ---------------------------------------------------- | -| Epic | restaurant manager | I want to be able to prepare the salary reports | my employees could get the right salary | -| High | restaurant manager | I want to ensure that data related to my restaurant is secure | not anyone can have access | +| High | restaurant manager | I want to ensure that only specific users are able to access the application | the data related to my restaurant is secure | | High | restaurant manager | I want to keep track of food expiry dates | the restaurant will not serve expired food | | High | restaurant manager | I want to note down my part timer's available dates | I can ensure there is enough manpower in the kitchen | | Medium | restaurant manager | I want to keep track of my monthly expenses | I know whether I am making a profit or loss | @@ -166,6 +167,8 @@ Target user profile: Restaurant Chef **Use case: Exit the program** +**MSS** + ​ 1. User requests to exit the program ​ 2. Program exits @@ -304,11 +307,18 @@ Target user profile: Restaurant Chef ### Appendix D: Non Functional Requirement +1. should work on any windows OS as long it has `java 11` or newer installed +2. The application needs to be secure. only specific users are able to access this application. for example, the restaurant manager as well as the chef +3. should be reliable in displaying accurate and correct data +4. should be easy to use for users with basic knowledge of command line interface +5. should be able to handle large amounts of data without displaying any slowdown in application performance +6. -### Appendix E: Glossary +### Appendix E: Glossary +1. ### Appendix F: Product Survey diff --git a/docs/UserGuide.md b/docs/UserGuide.md index e9a3c53d..8fb6d85d 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -3,21 +3,25 @@ 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] - - Load and save tasks to hard disk. [Level-7] - - Identify dates and times. [Level-8] - - delete: Delete a task. [Level-6] - - find: Find a task by searching for a keyword. [Level-9] + - bye: Exit the program + - list: Show all the tasks + - done: Mark a task as done + - todo: Create a new todo task + - deadline: Create a new deadline task + - event: Create a new event task + - Load and save tasks to hard disk + - Identify dates and times + - delete: Delete a task + - find: Find a task by searching for a keyword. + - Error Handling 4. Command Summary +5. FAQ ## 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. By using this product, you are able to order all the ingredients needed for your kitchen. Additionally, you can try out new recipes and save it in Duke. you can also view customer feedback. +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. By using this product, you are able to order all the ingredients needed for your kitchen. Additionally, this application takes in customers order/preorder of the restaurants dishes. The customers are able to give their feedback/rating of the dishes. the average rating of all the dishes can be viewed by the restaurant chef. Proceed to the Developer Guide [here]( https://github.com/AY1920S1-CS2113-T14-2/main/blob/master/docs/DeveloperGuide.md ) to learn more about this application. + + ## 2. Quick Start @@ -39,7 +43,7 @@ Duke is targeted towards restaurant chefs who wants to be able to consolidate mo 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 +7. Refer to Section 4 for the full list of commands ## 3. Features @@ -48,13 +52,13 @@ Duke is targeted towards restaurant chefs who wants to be able to consolidate mo - commands are in `UPPER_CASE` are to be provided by the user eg. `todo d/DESC`, `DESC` is a parameter which can be used as `todo d/buy groceries` - -### 3.1 bye: Exit the program. [Level-1] +### 3.1 bye: Exits the program outputs an exit message to the user and terminates the program Format: `bye` -### 3.2 list: Show all the tasks. [Level-2] +### 3.2 list: Show all the tasks Shows all the task marked done/undone to the user @@ -66,75 +70,108 @@ shows the user all the tasks that is stored in Duke 1.[D][✓] return book(by: Monday) 2.[E][✘] meeting(at: U-Town) 3.[P][✓] lecture(from: 1600 to: 1800) -### 3.3 done: Mark a task as done. [Level-3] +### 3.3 done: Mark a task as done marks a task in list as done. Format: `done` -eg. `done 1`, outputs: [ T ] [ ✓ ] return book +eg. `done 1` Nice! I've marked this task as done: [D][✓] return book(by: Monday) -### 3.4 todo: Create a new todo task. [Level-4] +### 3.4 todo: Create a new todo task creates a new task, todo where user enters the description of the task that needs to be done Format: `todo` -eg. `todo order eggs`, stores T|0|order eggs, outputs [ T ] [ ✘ ] order eggs +eg. `todo order eggs` Got it. I've added this task: [T][✘] order eggs Now you have 6 tasks in the list. -### 3.5 deadline: Create a new deadline task. [Level-4] +### 3.5 deadline: Create a new deadline task creates a new task, deadline, where user enters their tasks as well the date that the task needs to be done Format: `deadline` `/by` -eg. `deadline submit review /by 1/1/2019`, stores D|0|submit review|1/1/2019 , outputs [ D ] [ ✘ ] submit review (/by: 1/1/2019) +eg. `deadline submit review /by 1/1/2019`, stores D|0|submit review|1/1/2019 + +output: Got it. I've added this task: [D][✘ ] submit review(by: 1/1/2019) Now you have 5 tasks in the list. -### 3.6 event: Create a new event task. [Level-4] +### 3.6 event: Create a new event task creates a new task, event, where user enters their tasks as well the date that the task needs to be done Format: `event` `/at` -eg. `event birthday /at multi purpose hall`, stores E|0|submit review|multi purpose hall , outputs [ED ] [ ✘ ] birthday (/at: multi purpose hall) +eg. `event birthday /at multi purpose hall`, stores E|0|submit review|multi purpose hall + +output: Got it. I've added this task: [E][✘] birthday(at: multi purpose hall) Now you have 4 tasks in the list. -### 3.10 delete: Delete a task. [Level-6] +### 3.10 delete: Delete a task deletes a tasks that was stored in Duke regardless of it being marked as done or undone. Format: `delete` -eg. `delete 1`, deletes the first task that is stored in Duke, if task does not exist, output an error message to user `Enter a valid task number after done, between 1 and x` (x is the total number of tasks in Duke) +eg. `delete 1`, deletes the first task that is stored in Duke + +output: Noted. I've removed this task: [T][✓] read book Now you have 3 tasks in the list. -### 3.12 find: Find a task by searching for a keyword. [Level-9] +### 3.12 find: Find a task by searching for a keyword finds a task in Duke which contains a specific word or description Format: `find` -eg. `find eggs`, iterates through all the task in Duke and if any of the tasks contains the description, output the task to the user +eg. `find eggs`, iterates through all the task in Duke and if any of the tasks contains the description, + +output: Here are the matching tasks in your list: 1.[T][✘] stock up on eggs 2.[D][✘] buy eggs(by: Monday) 3.[T][✘] create a new egg sandwich -if there are no matches, outputs `No matching tasks found!` +### 3.13 Error Handling + +handles unexpected commands from the user such as unknown/incomplete command. if user enters an invalid command, the application will output a message that corresponds to what the user entered wrongly. + +eg. `deadline` , `deadline` `by` , `delete` + +outputs: + +``` + ____________________________________________________________ + ☹ OOPS!!! The description cannot be empty. + ____________________________________________________________ + +``` + +### 3.14 stats: gives the statistics of the Dish + +### 3.15 order: creates a new order + +### 3.16 preorder: + +### 3.17 help: shows a list of commands to the user + +things to include in version 2: + +... ## 4. Command Summary @@ -142,10 +179,25 @@ Index | Keyword | Usage ----- | -------- | ---------- 1 | bye | bye 2 | list | list -3 | done | done \ -4 | todo | todo \ -5 | deadline | deadline \ /by \ -6 | event | event \ /at \ -7 | delete | delete \ -8 | find | find \ +3 | done | done +4 | todo | todo +5 | deadline | deadline /by +6 | event | event /at +7 | delete | delete +8 | find | find 9 | remind | remind +10 | stats | stats +11 | order | order +12 | preorder | preorder +13 | cancel | cancel +14 | help | help + +# 5. FAQ + +Q: how do I transfer data to another computer + +A: install the application on the other computer and an empty recipe.txt will be created under the data folder. Replace this file with the same file found in your previous computer. therefore your data will be transferred + +Q: + +A: \ No newline at end of file diff --git a/docs/images/UMLsequence.png b/docs/images/UMLsequence.png new file mode 100644 index 00000000..eb783ce2 Binary files /dev/null and b/docs/images/UMLsequence.png differ diff --git a/docs/images/architectureV1.1.png b/docs/images/architectureV1.1.png new file mode 100644 index 00000000..eab7aa5d Binary files /dev/null and b/docs/images/architectureV1.1.png differ diff --git a/src/main/java/duke/Duke.java b/src/main/java/duke/Duke.java index 20593e09..4fa7b86a 100644 --- a/src/main/java/duke/Duke.java +++ b/src/main/java/duke/Duke.java @@ -3,6 +3,7 @@ import duke.command.Command; import duke.exception.DukeException; import duke.parser.Parser; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.TaskList; import duke.ui.Ui; @@ -15,12 +16,14 @@ public class Duke { private Storage storage; private TaskList tasks; private Ui ui; + private dishlist dish; /** * The constructor method for Duke. * @param filePath used to specify the location of the file in the hard disc. */ public Duke(String filePath) { + dish = new dishlist(); ui = new Ui(); storage = new Storage(filePath); try { @@ -42,7 +45,7 @@ public void run() { String fullCommand = ui.readCommand(); ui.showLine(); Command c = Parser.parse(fullCommand, tasks.size()); - c.execute(tasks, ui, storage); + c.execute(dish, tasks, ui, storage); isExit = c.isExit(); } catch (DukeException e) { ui.showError(e.getMessage()); diff --git a/src/main/java/duke/command/AddCommand.java b/src/main/java/duke/command/AddCommand.java index 3ae09464..4bc0e0e7 100644 --- a/src/main/java/duke/command/AddCommand.java +++ b/src/main/java/duke/command/AddCommand.java @@ -1,6 +1,8 @@ package duke.command; import duke.exception.DukeException; +import duke.recipebook.dishes; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.Task; import duke.task.TaskList; @@ -14,6 +16,7 @@ public class AddCommand extends Command { private Task task; + private dishes dish; /** * The constructor method for AddCommand. @@ -24,6 +27,10 @@ public AddCommand(Task task) { this.task = task; } + public AddCommand(dishes dish) { + this.dish = dish; + } + /** * Public method used to add the task in the taskList, and write it on the hard disc. * @@ -33,13 +40,15 @@ public AddCommand(Task task) { * @throws DukeException Error while adding the command to the duke.txt file */ @Override - public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException { + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) throws DukeException { taskList.addTask(task); - ui.showAddCommand(task.toString(), taskList.size()); - try { - storage.addCommandInFile(task.printInFile()); - } catch (IOException e) { - throw new DukeException("Error while adding the command to the duke.txt file"); - } + dish1.addDish(dish); // add dish into list found in dishes class + System.out.println("\t dish added: " + dish.toString() + "\n\t amount :" + dish.getAmount()); +// ui.showAddCommand(task.toString(), taskList.size()); +// try { +// storage.addCommandInFile(task.printInFile()); +// } catch (IOException e) { +// throw new DukeException("Error while adding the command to the duke.txt file"); +// } } } diff --git a/src/main/java/duke/command/Command.java b/src/main/java/duke/command/Command.java index 5bd2c399..f4d10b0c 100644 --- a/src/main/java/duke/command/Command.java +++ b/src/main/java/duke/command/Command.java @@ -1,6 +1,7 @@ package duke.command; import duke.exception.DukeException; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.TaskList; import duke.ui.Ui; @@ -10,7 +11,7 @@ */ public abstract class Command { - public abstract void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException; + public abstract void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) throws DukeException; /** * Returns the boolean indicating that it is( not) an {@link ExitCommand}. diff --git a/src/main/java/duke/command/DeleteCommand.java b/src/main/java/duke/command/DeleteCommand.java index a879ad7d..4e721634 100644 --- a/src/main/java/duke/command/DeleteCommand.java +++ b/src/main/java/duke/command/DeleteCommand.java @@ -1,6 +1,7 @@ package duke.command; import duke.exception.DukeException; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.Task; import duke.task.TaskList; @@ -23,7 +24,7 @@ public DeleteCommand(int taskNb) { } @Override - public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException { + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) throws DukeException { if (taskNb < taskList.size() && taskNb >= 0) { Task removed = taskList.removeTask(taskNb); List fileContent = null; diff --git a/src/main/java/duke/command/DoneCommand.java b/src/main/java/duke/command/DoneCommand.java index 62f7f0c7..516921c7 100644 --- a/src/main/java/duke/command/DoneCommand.java +++ b/src/main/java/duke/command/DoneCommand.java @@ -1,6 +1,7 @@ package duke.command; import duke.exception.DukeException; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.Task; import duke.task.TaskList; @@ -17,7 +18,7 @@ public DoneCommand(int taskNb) { } @Override - public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException { + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) throws DukeException { if (taskNb < taskList.size() && taskNb >= 0) { taskList.markTaskDone(taskNb); ui.showMarkDone(taskList.getTask(taskNb).toString()); diff --git a/src/main/java/duke/command/ExitCommand.java b/src/main/java/duke/command/ExitCommand.java index e0d2ab04..5c3f2e0e 100644 --- a/src/main/java/duke/command/ExitCommand.java +++ b/src/main/java/duke/command/ExitCommand.java @@ -1,5 +1,6 @@ package duke.command; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.TaskList; import duke.ui.Ui; @@ -15,7 +16,7 @@ public boolean isExit() { } @Override - public void execute(TaskList taskList, Ui ui, Storage storage) { + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) { System.out.println("\t Bye. Hope to see you again soon!"); } } diff --git a/src/main/java/duke/command/FindCommand.java b/src/main/java/duke/command/FindCommand.java index c829066c..62a7f26d 100644 --- a/src/main/java/duke/command/FindCommand.java +++ b/src/main/java/duke/command/FindCommand.java @@ -1,5 +1,6 @@ package duke.command; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.Task; import duke.task.TaskList; @@ -17,7 +18,7 @@ public FindCommand(String toFind) { } @Override - public void execute(TaskList taskList, Ui ui, Storage storage) { + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) { StringBuilder sb = new StringBuilder(); int i = 1; for (Task task : taskList.getAllTasks()) { diff --git a/src/main/java/duke/command/FindToday.java b/src/main/java/duke/command/FindToday.java new file mode 100644 index 00000000..ad82b3e1 --- /dev/null +++ b/src/main/java/duke/command/FindToday.java @@ -0,0 +1,42 @@ +package duke.command; + +import duke.recipebook.dishlist; +import duke.storage.Storage; +import duke.task.Task; +import duke.task.TaskList; +import duke.ui.Ui; + + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class FindToday extends Command { + private Date today = new Date(); + private String pattern = "dd/MM/yyyy"; + private SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); + private String TodayDate = simpleDateFormat.format(today); + + @Override + public boolean isExit() { + return false; + } + + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) { + int i = 1; + StringBuilder sb = new StringBuilder(); + for (Task task : taskList.getAllTasks()) { + if (task.getDescription().contains(TodayDate)) { + sb.append("\t ").append(i++).append(".").append(task.toString()); + sb.append(System.lineSeparator()); + } + } + if (sb.length() == 0) { + System.out.println("No ingredients for today!"); + } else { + System.out.println("\t Here are the ingredients for today"); + } + sb.setLength(sb.length() - 1);// to remove the last new line + System.out.println(sb.toString()); + } +} + diff --git a/src/main/java/duke/command/InitCommand.java b/src/main/java/duke/command/InitCommand.java new file mode 100644 index 00000000..ea028d87 --- /dev/null +++ b/src/main/java/duke/command/InitCommand.java @@ -0,0 +1,22 @@ +package duke.command; + +import duke.exception.DukeException; +import duke.recipebook.dishlist; +import duke.storage.Storage; +import duke.task.TaskList; +import duke.ui.Ui; +import duke.recipebook.dishes; + +public class InitCommand extends Command { + + private Boolean status = false; + + public InitCommand() { + //clears all the amount in dishes + } + + @Override + public void execute(dishlist dish, TaskList taskList, Ui ui, Storage storage) throws DukeException { + //something + } +} diff --git a/src/main/java/duke/command/ListCommand.java b/src/main/java/duke/command/ListCommand.java index 8ea3e96e..357921ea 100644 --- a/src/main/java/duke/command/ListCommand.java +++ b/src/main/java/duke/command/ListCommand.java @@ -1,6 +1,7 @@ package duke.command; import duke.exception.DukeException; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.TaskList; import duke.ui.Ui; @@ -11,7 +12,7 @@ public class ListCommand extends Command { @Override - public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException { + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) throws DukeException { if (taskList.size() == 0) { throw new DukeException("No tasks yet!"); } else { diff --git a/src/main/java/duke/command/RemindCommand.java b/src/main/java/duke/command/RemindCommand.java index 37e611c4..1371b7df 100644 --- a/src/main/java/duke/command/RemindCommand.java +++ b/src/main/java/duke/command/RemindCommand.java @@ -1,6 +1,7 @@ package duke.command; import duke.exception.DukeException; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.TaskList; import duke.ui.Ui; @@ -20,7 +21,7 @@ public RemindCommand() { } @Override - public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException { + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) throws DukeException { int num = 1; LocalDate date = LocalDate.now(); LocalDate date1 = date.plusDays(5); diff --git a/src/main/java/duke/command/Snooze.java b/src/main/java/duke/command/Snooze.java index 9fc9e332..b5196839 100644 --- a/src/main/java/duke/command/Snooze.java +++ b/src/main/java/duke/command/Snooze.java @@ -2,6 +2,7 @@ import duke.exception.DukeException; import duke.parser.Convert; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.TaskList; import duke.ui.Ui; @@ -31,7 +32,7 @@ public Snooze(int taskNb, String until) { } @Override - public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException { + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) throws DukeException { if (taskNb < taskList.size() && taskNb >= 0) { if (taskList.getTask(taskNb).isDone()) { throw new DukeException("Seems like you've already finished that task, no need to snooze it now"); diff --git a/src/main/java/duke/command/ViewCommand.java b/src/main/java/duke/command/ViewCommand.java index e2315f2f..dfcec6d6 100644 --- a/src/main/java/duke/command/ViewCommand.java +++ b/src/main/java/duke/command/ViewCommand.java @@ -1,5 +1,6 @@ package duke.command; +import duke.recipebook.dishlist; import duke.storage.Storage; import duke.task.Task; import duke.task.TaskList; @@ -20,7 +21,7 @@ public ViewCommand(Date toView) { } @Override - public void execute(TaskList taskList, Ui ui, Storage storage) { + public void execute(dishlist dish1, TaskList taskList, Ui ui, Storage storage) { StringBuilder sb = new StringBuilder(); int i = 1; try { diff --git a/src/main/java/duke/parser/Parser.java b/src/main/java/duke/parser/Parser.java index 6b6385f4..df0821a9 100644 --- a/src/main/java/duke/parser/Parser.java +++ b/src/main/java/duke/parser/Parser.java @@ -10,6 +10,7 @@ import duke.command.ViewCommand; import duke.exception.DukeException; import duke.orderCommand.*; +import duke.recipebook.dishes; import duke.task.Deadline; import duke.task.DoWithinPeriodTasks; import duke.task.Event; @@ -37,11 +38,13 @@ public class Parser { */ public static Command parse(String fullCommand, int size) throws DukeException { //splitted contains the keyword and the rest (description or task number) - String[] splitted = fullCommand.split(" ", 2); + String[] splitted = fullCommand.split(" ", 3); //switching on the keyword switch (splitted[0]) { case "list": return new ListCommand(); + case "listtoday": + return new FindToday(); case "bye": return new ExitCommand(); case "done": @@ -79,6 +82,9 @@ public static Command parse(String fullCommand, int size) throws DukeException { String[] getPart = splitAndCheck(splitted[1], " /from "); String[] part = splitAndCheck(getPart[1], " /to "); return new AddCommand(new DoWithinPeriodTasks(getPart[0], part[0], part[1])); + case "add": + int amount = Integer.parseInt(splitted[2]); + return new AddCommand(new dishes(splitted[1], amount)); default: throw new DukeException("I'm sorry, but I don't know what that means :-("); } diff --git a/src/main/java/duke/recipebook/dishes.java b/src/main/java/duke/recipebook/dishes.java new file mode 100644 index 00000000..3c482270 --- /dev/null +++ b/src/main/java/duke/recipebook/dishes.java @@ -0,0 +1,52 @@ +package duke.recipebook; + +import duke.storage.Storage; +import duke.ui.Ui; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public class dishes{ + + private String dishname; + private int total; + private float rating; + + public dishes(String name, int amount) { + this.dishname = name; + this.total = amount; + } + + public dishes() { + // + } + + public int getAmount() { + return total; + } + + public void setAmount(int amount) { + total = total + amount; + } + + public void clearAmount() { + total = 0; + } + + public String getDishname() { + return dishname; + } + + public void setRating(int r) { + rating = (total * rating + r) / total; + } + + public float getRating() { + return rating; + } + + public String toString() { + return dishname; + } +} diff --git a/src/main/java/duke/recipebook/dishlist.java b/src/main/java/duke/recipebook/dishlist.java new file mode 100644 index 00000000..1e592456 --- /dev/null +++ b/src/main/java/duke/recipebook/dishlist.java @@ -0,0 +1,28 @@ +package duke.recipebook; + +import java.util.ArrayList; +import java.util.List; + +public class dishlist extends dishes { + private static List dishlist; + + public dishlist() { + dishlist = new ArrayList<>(); + } + + public static void addDish(dishes name) { + dishlist.add(name); + } + + public static int getsize() { + return dishlist.size(); + } + + public void clearList() { + dishlist.clear(); + } + + public String toString(dishes dish) { + return dish.toString(); + } +}