-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CS2113-T12-2] Grocery in Time #33
base: master
Are you sure you want to change the base?
Changes from 205 commits
c9fe1df
15f3841
2bde7e6
f2ed673
e877ef9
e55af58
49f85fd
5643e96
5a122c1
9c9e94a
5a82d2a
6bfb05d
3dbcf39
a7d3181
8800c7c
cb79132
bcb3a7c
3caeb74
4248f24
f9286f6
8ed2025
ac55803
e74febf
1039cdf
2d69dd1
2bd316e
207b56f
5e4e5a5
e169257
9e25724
4d175f7
d4befa7
55d3988
b0eb5dd
2dba80d
59dd34c
de48ac7
fe249a0
8152c18
e586b4a
2f6560e
a1b3de5
7db2696
6c89239
a93c1ea
07806ed
5a76900
1d37809
173cc6d
31d27a8
68c94ca
bf5d8b9
b62341a
79a368b
d501db7
0be47be
9baa8f3
18cbce1
1631780
55bb7bf
04d86d3
95697c0
5c401a4
772b4f1
30acf9a
2beef51
8100a45
de28661
d45c167
a8218ed
bea0894
6fe68bc
b1450ca
b4c6b0c
d29a511
565431f
1374e9b
234b296
d4e81bf
835aa14
b293cc1
4375da0
8068f4b
79e3eb1
fb47747
bb5c971
21d6128
b4b7042
ded4336
12c3ed4
e7bedbb
7858e0b
ee1ec7b
d2f12ab
23ec462
57737af
849e87a
ad94616
5408403
79eeca1
6efc320
84f8aa6
6bfe1c1
64658f6
647ff19
9a23360
b886879
9bc047f
2e62e34
30928a4
76d9ad4
62c2233
3f23dcd
e85947f
0fd3c42
a540b5a
e5246f7
d838331
fdaf42d
7f8d099
8778db2
769737e
70ea802
5f0d79b
01adbfb
ec06d46
7bf5f58
bc3e0cf
2fd101a
9bd3ad8
430e3f9
e4fb583
7b61506
abea7b2
91555a4
b0ce1ba
04b8ae8
41ccce9
03c2b41
75d2d1f
555e67e
c4f8cc7
c930aba
14ae938
64ec3b9
629b936
01cf507
89ff41d
64f6c5f
1fee5a6
322a118
ac56caf
b1a7a4f
7e3dc7e
1a5cd0c
919df84
b4fcded
87b21ad
a8f99b7
34ae7b5
47ee28d
241a869
b9cf987
e2b9a2e
20afdde
20893f2
7ac453a
f3dffc4
7576010
b80342e
a7d8f9b
8cd6496
8fcb731
6d0bd17
dfe6665
96768b9
48be00e
d8cadce
16aab81
df01ea9
719d557
59c2f83
ae0efeb
d544799
0751d8a
5ac5683
9ed2cb6
879b948
56d82a3
d147cd2
175289a
532fa9a
0a97f0e
612443e
44b8558
729c844
04c961c
e49e8f7
22afac6
9019023
4c10a6a
0cdbe3d
d9d4974
844b26a
58437a8
9dd042e
af9e7c6
e6081c7
6676d54
7a5ff3c
d4805e8
e2051c9
a8b0813
d082cea
2ccefa7
a136367
90f36f1
1a40b79
e1fcbcd
b6d0f1a
818da9e
fd7c4cf
728120b
3ae8988
72e2d91
5b25698
58e3b83
9d5b73c
9c365c5
8b2af63
9b59ff4
5830980
386e51e
e045f10
32f4652
6b08faa
2ca2e97
e1ccdf6
bdf6e45
2eeae89
be24e2b
8822ebd
3e72dd8
bf36428
d932b66
eb728aa
ed5201a
fbbcadd
5edeab7
2cdab08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,7 @@ bin/ | |
|
||
/text-ui-test/ACTUAL.TXT | ||
text-ui-test/EXPECTED-UNIX.TXT | ||
|
||
GroceryList.log | ||
GroceryList.log.lck | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"recommendations": [ | ||
"markis.code-coverage" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "interactive" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# About us | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:----:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
Display | Name | Github Profile | Portfolio | ||
--------|:----------:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | Luo Zi Hui | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Liu Siyi | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Willson Han Zhekai | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Sharlyn Lui | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Luo Yu | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,23 +7,99 @@ | |
## Design & implementation | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to re-iterate the value proposition of your app at the beginning of the design and implementation section. |
||
### 1. View all groceries added | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The numbering here is a bit confusing, I am not sure about how the DG is organized, because "Calories Management" was given index 1 earlier, so I am not sure how that fits in. |
||
* First create a method in "Grocery" class that prints the grocery in a preferred format.\ | ||
e.g., NAME, AMOUNT, EXPIRATION, PRICE. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you provide a sample of the formats for all those inputs? (I can see you have already specified the format of expiration, but maybe a sample for all is more intuitive for other developers) |
||
* Then create a method in "GroceryList" class that prints all the groceries in the list. | ||
|
||
|
||
### 2. List the groceries by price in descending order | ||
* First, create a field in "Grocery" class that stores the cost of a grocery. | ||
* When adding a grocery, prompt the user to enter the cost. | ||
* Format the cost into 2 decimal places, remove the dollar sign and store it as a string. | ||
* Second, the grocery's cost accordingly before adding it into the list. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there seems to be a grammatical error here which makes the meaning difficult to understand. |
||
* When setting the cost, convert the cost from String into Double. | ||
* Third, add method in "GroceryList" class to create a copy of the current grocery list, then sort the | ||
new grocery list by price using lambda function. Reverse and print the new list. | ||
|
||
|
||
### 3. Input category for each grocery added | ||
* In Grocery class, modified the Grocery constructor to accept the 'category' parameter. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps it's better to phrase it this way, "the Grocery constructor was modified to accept the 'category' parameter". |
||
* In Parser class executeCommand method, modified the add command to prompt the user for the category of the grocery. Passed the category as a parameter when creating a new Grocery object. | ||
* In Ui class, added a new method promptForCategory to prompt the user for the category of the grocery. | ||
* In Grocery class, modified the printGrocery method to include the category information in the output string. | ||
Comment on lines
+159
to
+161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same phrasing issue, try to phrase it in passive voice. |
||
|
||
|
||
### 4. Input amount for each grocery added | ||
* In Grocery class, modified the Grocery constructor to accept the 'amount' parameter. | ||
* In Parser class executeCommand method, modified the add command to prompt the user for the amount of grocery. Passed the amount as a parameter when creating a new Grocery object. | ||
* In Ui class, added a new method promptForAmount to prompt the user for the amount of grocery. | ||
* In Grocery class, modified the printGrocery method to print different units of measurement for different categories. | ||
|
||
|
||
### 5. Input the location of where each grocery is stored | ||
* In Grocery class, modified the Grocery class to include location (String) as an attribute. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be clearer if "location" is formatted as code. |
||
* In Grocery class, modified the Grocery constructor to accept the 'location' parameter. | ||
* In Grocery class, under printGrocery, added locationString to format location. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The explainations are relatively accurate and useful, excellant! |
||
* In Parser class executeCommand method, modified the add command to prompt the user for where the grocery is stored. Passed the location as a parameter when creating a new Grocery object. | ||
* In Ui class, added promptForLocation method to take in user input for location of the grocery. | ||
* In Ui class, modified the printGrocery method to print the 'location' of the grocery alongside the grocery name. | ||
* Alternative considered: Can possibly add location as enumeration however different people might store groceries in different places thus better to set as String so that user is free to input location details however specific they want. | ||
|
||
### 6. Edit grocery amount after using a grocery | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* A `Grocery` stores its `amount` as an attribute. All `Grocery` objects are then stored in an ArrayList in `GroceryList`, which entirely handles the editing of the `amount`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious, is the amount: int referring to quantity of the grocery item? There is also a cost attribute in the Grocery class as mentioned in line 18. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Diagrams are simplified and easy to understand. Well done! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The diagrams are quite clear and neat as well as carefully matches the UG. however some of the minor detail seems missing such as after playing the game how the user quite and is it possible to store the information? |
||
|
||
![Grocery (showing amount) and GroceryList class diagram](./diagrams/GroceryAmtGroceryList.png) | ||
|
||
* `GroceryList#editAmount()` is used to either decrease or directly set the `amount` of a `Grocery`. It takes in 2 parameters: | ||
1. details: String — User input read from `Scanner`. | ||
2. use: boolean — `true` decreases the `amount`, while `false` directly sets it. | ||
* To edit the `amount` after using a `Grocery`, the user inputs `use GROCERY a/AMOUNT`. | ||
Our app then executes `GroceryList#editAmount()` with parameter `use = true`, as illustrated by the following sequence diagram. | ||
|
||
![useAmt sequence diagram](./diagrams/useAmt.png) | ||
|
||
* Additional checks specific to `use` ensure that the user only inputs a valid `int`, or that the `amount` must not be 0 beforehand. | ||
* Any exceptions thrown come with a message to help the user remedy their specific issue, as displayed by the `Ui`. | ||
|
||
### 7. Input expiration date of each grocery when added | ||
* In Grocery class, the expiration field in the Grocery class was changed from a String to a LocalDate to standardize date handling. | ||
* In Grocery class, the setExpiration method was updated to accept a String input, convert it to a LocalDate using a specified format ("yyyy-MM-dd"), and then store this date. | ||
* In UI class, the UI now includes a multi-step process to prompt the user for the year, month, and day of the grocery item's expiration date. This process ensures that the date is captured in a user-friendly manner and stored accurately. | ||
* In GroceryList class, a new method, sortByExpiration, was added to allow sorting the list of groceries by their expiration dates in ascending order. This method utilizes the Collections.sort method with a lambda expression comparing the expiration dates of Grocery items. | ||
|
||
### 8. Editing expiration date after it is added | ||
* In GroceryList class, modified the editExpiration method to parse String into localdate. | ||
|
||
|
||
## Product scope | ||
### Target user profile | ||
|
||
{Describe the target user profile} | ||
Our target user is someone who regularly goes grocery shopping, and would like to track and manage their inventory of groceries. | ||
|
||
### Value proposition | ||
|
||
{Describe the value proposition: what problem does it solve?} | ||
Grocery in Time aims to act as an easy-to-use central database for all the user's groceries. Managing many groceries stored at different locations around the house can get confusing, | ||
therefore our app will allow users to track their groceries easily. | ||
|
||
Users are able to edit and manage the category, amount, expiration date, and storage location of their groceries. | ||
When groceries are running low, the app can generate a shopping list to remind users of what they need to buy. | ||
Furthermore, the app can generate a list of items that are expiring soon, reminding users to consume their groceries as soon as possible. | ||
|
||
## User Stories | ||
|
||
|Version| As a ... | I want to ... | So that I can ...| | ||
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
| Version | As a ... | I want to ... | So that I can ... | | ||
|---------|-------------------------------|---------------------------------------------|--------------------------------------------------------| | ||
| v1.0 | new user | see instructions on how to use the app | refer to them when I forget how to use the application | | ||
| v1.0 | user | add groceries to the app | manage all my groceries | | ||
| v1.0 | user | view all my groceries | know what I have bought | | ||
| v1.0 | user | delete groceries from the list | stop tracking those groceries | | ||
| v1.0 | user | add the amount of a grocery | keep track of the amount of that item I have | | ||
| v1.0 | user | add the expiration date of the grocery | keep track of when my items expire easily | | ||
| v2.0 | financially-aware user | add the cost of the groceries | know how much I am spending | | ||
| v2.0 | health-conscious user | categorise my groceries | know what types of groceries I have | | ||
| v2.0 | user with many storage spaces | add the location of where an item is stored | see where I keep my groceries | | ||
| v2.0 | user who consumes groceries | track the usage of my groceries | know how much I have left | | ||
|
||
## Non-Functional Requirements | ||
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your functionality for each version looks quite precise and straight to the point of what is needed for such product. Goodjob! However is there any other types of users you have to consider to add on other than financially-awre and health-concious, such as alergic to some food? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@startuml | ||
skinparam classAttributeIconSize 0 | ||
|
||
class GroceryList | ||
GroceryList : +editAmount(details : String, use : boolean) | ||
|
||
class Grocery | ||
Grocery : -amount : int | ||
|
||
GroceryList "1" ---> "*" Grocery : stores > | ||
|
||
|
||
@enduml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks neat and organized! Perhaps you can an overall sequence diagram for your whole program to show how it works overall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, class diagrams for classes like
Ui
,Parser
,Grocery
would better illustrate and complement your explanations