-
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-T15-4] StockMaster #45
base: master
Are you sure you want to change the base?
Changes from 250 commits
ce0ede8
07216af
9e03c6b
8093c63
9518a4b
d08e86d
5416497
3d963be
20cc9fa
d303915
bf960ce
5d000ad
b3a4a6a
313478c
f1d26f8
dae7003
ef053ea
49f6f99
800525e
f8901d7
4ba4675
0fd810e
bb74c23
192bf2e
12580e3
f6a53fc
2c72d23
dae6d6c
fa4f274
5b93e25
d87bae3
240f826
3054dce
90c4ff0
689e9fc
4eae720
1cadb5d
4dc3173
b57fb20
a50ef35
fcb74d1
13f80f8
6dd7581
d482ce3
ef479de
1d3b63a
e6a99b4
17f4dcf
81731e6
a88dc19
9e3f46c
57028b6
128bfb4
440965a
84085f2
eec36ca
a8ba256
422efa0
3ce8683
aa4cb96
f2404f0
f80ad98
357a176
c7c7d12
7002ddf
6fd86ed
b9d0400
fd3b464
a3b2d3a
df37d94
f2431ad
3c9742e
8a21b1e
acd9322
1a4eb83
4a7e061
2fe0186
a1789ae
a8ce114
be4c6ed
aab03a2
887dec5
1c67281
0b09ad7
cd6da3d
dee8d14
abd5eff
8133bdc
992e7ce
319278d
1f5b883
71195f9
09dcebd
32732ad
3d94eb5
daa5553
877bf0e
278b03a
42e2882
7db31fc
174e677
2e01714
d28f7ac
0ecfa0b
6bb8f0f
a373a25
194439a
ec68de6
90df63e
b782534
e17ec71
53f1e36
6ea4129
ce958b2
bf287a1
974ac07
f01c1a8
e95f304
3218d45
ac1893d
b664cab
5c4d8e9
33b84ca
3c1953a
f89d170
b9d65e9
38cd86f
17b4fd7
a957bbc
cdd9ea4
78d5d10
0085989
6914fba
2aba5da
2d10131
e28e748
d552f59
10697b7
105e955
9f0a697
eb59ebf
de98256
06d9a7e
cefeb07
3222737
41b8dcd
f83d093
76f73c5
9785e99
10c6d35
a2b40c4
19b9da6
d90f014
7ecf8b3
fc27959
88017f9
220d4a1
67f28a4
236bbc7
5504d2e
b15c2a4
11d9815
ad56d09
2d875a5
bc1ac64
c5b924c
70030f3
e5f4965
b7ab323
4ee8040
88036a8
a03a871
1683023
adebf26
a288034
a279e5b
b2f8aea
451e6dd
f49ab34
f039efd
c6125b1
6014ac3
c3a2da8
4fcfc49
66aef4f
428d41e
2de0bc2
8952566
6be78c0
b919e8c
d139b55
03a32a6
0af0b65
2a0436e
47f0306
1dcd0f8
b26ff83
327dc0d
be27e77
c54ae2c
0840840
5cb1e27
2b82ec2
bdef6c8
d73f1f3
59b5622
4718547
ae37ea6
2d72115
9d4caee
3e3d461
5844478
37f8f94
6a6453f
67c97c6
94ae2dd
26bd145
f36ca68
0c4fe17
2512105
032a5fc
81cbe8b
e34c4c8
842a9b3
0daa502
314d23f
11a052a
2674260
9fc25e7
cfd1a86
0f4ce44
9730867
515990a
f44550e
75adf1f
1da147b
416cc83
5ed4e86
3d1b5b1
506e453
a68914e
b346489
598dc37
b32453c
163d19e
5e301f4
0f7fb46
6b8d3d5
4e82f9f
53c817f
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1. | testItem | Qty: 1 EA | Cat: null | BuyPrice: $1.0 | SellPrice: $10.0 | ||
2. | testItem | Qty: 1 EA | Cat: null | BuyPrice: $1.0 | SellPrice: $10.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Date: 2024-04-01 21:32:44 | ||
Transaction ID: 1 | ||
Item Name: apple | ||
Quantity: 5 | ||
Unit Price: 3.0 | ||
Total Price: 15.0 | ||
Profit: -5.0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,5 @@ checkstyle { | |
|
||
run{ | ||
standardInput = System.in | ||
} | ||
enableAssertions = true | ||
} |
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) | Low Tjun Lym | [Github](https://github.com/LowTL) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Fu Xueer | [Github](https://github.com/fxe025) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Heng Shu Hong | [Github](https://github.com/HengShuHong) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Joel Lim | [Github](https://github.com/joellimjr) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Min Guanlin | [Github](https://github.com/Fureimi) | [Portfolio](docs/team/johndoe.md) |
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 document looks neat! 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. Do consider adding in more visuals (sequence diagrams, class diagrams, etc.) for explanatory purposes. 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. maybe the diagram is a bit small |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,31 +7,67 @@ | |
## Design & implementation | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
### Exception | ||
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 you could elaborate more on how your exception works |
||
### Itemlist | ||
Itemlist class is an object which contains items to be added to the stock inventory list. Able to add items, remove functions, edit items inside | ||
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. Seems like you meant to say |
||
the list. | ||
### Item | ||
Item class is an object which represents an item in the stock inventory list. Stores data about the item such as item price, | ||
quantity of item, and others. | ||
### Parser | ||
Parser class processes user inputs and sieves out relevant details before calling the relevant methods. | ||
It contains command formats that must be adhered to for the methods to be called. | ||
### Storage | ||
Storage class contains methods to write description of items to the file `./StockMasterData.txt`, | ||
and retrieve information from the file when program restarts. | ||
### UI | ||
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 your UI and Exception class is missing a description |
||
|
||
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 you can add some description regarding your implementation for the functionalities |
||
|
||
## Product scope | ||
StockMaster allows users to use the following commands: | ||
* add: add an item, quantity, category, buy price and sell price | ||
* del: delete an item | ||
* edit: edit the quantity of an item | ||
* sell: sell a certain quantity of an item at a stated price | ||
* find: find a specific item using a keyword | ||
* list: list all items in the inventory | ||
* help: list all commands | ||
* exit: exit StockMaster | ||
|
||
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. Hopefully, you can explain what the contents of each methods are and how the methods communicate with each related methods. This DG is to teach an interested developer how to contribute to the codebase. |
||
### Target user profile | ||
|
||
{Describe the target user profile} | ||
Small Business Owners who: | ||
* has a need to manage a significant number of inventory products | ||
* able to track revenue/loss of the business | ||
* prefer desktop apps over other types | ||
* can type fast | ||
* prefers typing to mouse interactions | ||
* is reasonably comfortable using CLI apps | ||
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. Target users are clearly defined. Good job! |
||
|
||
### Value proposition | ||
|
||
{Describe the value proposition: what problem does it solve?} | ||
Help small business owners organise and better manage their inventory faster than | ||
a typical mouse/GUI driven app | ||
|
||
|
||
## 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 usage instructions | refer to them when I forget how to use the application | | ||
|v1.0|user| add new items | | | ||
|v1.0|user| make changes to added items | change details about items such as quantity or price | | ||
|v1.0|user| search for specific items || | ||
|v2.0|user| find a to-do item by name | locate a to-do without having to go through the entire list | | ||
|
||
## Non-Functional Requirements | ||
|
||
{Give non-functional requirements} | ||
|
||
## Glossary | ||
|
||
* *glossary item* - Definition | ||
* *CLI* - Command Line Interface, where the user types commands rather than clicking options. | ||
* *Item* - Item to be sold at the shop, with key information such as quantity, buying/selling price, description etc. | ||
|
||
## Instructions for manual testing | ||
|
||
|
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. You should add the return arrows to your sequence diagram 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. Good job in use red to diftinquish the parts. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package command; | ||
|
||
import item.Item; | ||
import itemlist.Itemlist; | ||
import storage.Storage; | ||
|
||
public class AddCommand extends Command { | ||
|
||
public static final String MESSAGE_SUCCESS = "added: "; | ||
protected String itemName; | ||
protected int quantity; | ||
protected String unitOfMeasurement; | ||
protected String category; | ||
protected float buyPrice; | ||
protected float sellPrice; | ||
private final Item toAdd; | ||
|
||
public AddCommand(String itemName, int quantity, String unitOfMeasurement, String category, float buyPrice, | ||
float sellPrice) { | ||
this.itemName = itemName; | ||
this.quantity = quantity; | ||
this.unitOfMeasurement = unitOfMeasurement; | ||
this.category = category; | ||
this.buyPrice = buyPrice; | ||
this.sellPrice = sellPrice; | ||
this.toAdd = new Item(itemName, quantity, unitOfMeasurement, category, buyPrice, sellPrice); | ||
} | ||
|
||
public String getItemName() { | ||
return itemName; | ||
} | ||
public int getQuantity() { | ||
return quantity; | ||
} | ||
public String getCategory() { | ||
return category; | ||
} | ||
public String getUnitOfMeasurement() { | ||
return unitOfMeasurement; | ||
} | ||
public float getBuyPrice() { | ||
return buyPrice; | ||
} | ||
public float getSellPrice() { | ||
return sellPrice; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
if (Itemlist.itemIsExist(itemName)) { | ||
updateQuantity(itemName); | ||
} else { | ||
Itemlist.addItem(toAdd); | ||
System.out.print(MESSAGE_SUCCESS + getItemName() + " (Qty: " + getQuantity() + " " + getUnitOfMeasurement() | ||
+ ", Buy: $" + getBuyPrice() + ", Sell: $" + getSellPrice() + ")"); | ||
Storage.addToFile(Itemlist.getItems()); | ||
if (!category.equals("NA")) { | ||
System.out.println(" to " + getCategory()); | ||
} else { | ||
System.out.println(); | ||
assert category.equals("NA"); | ||
} | ||
} | ||
} | ||
|
||
public void updateQuantity(String itemName) { | ||
System.out.println("Item already exists and quantity has been changed"); | ||
int indexOfItem = -1; | ||
for (Item item : Itemlist.getItems()) { | ||
if (item.getItemName().toLowerCase().equals(itemName)) { | ||
indexOfItem = Itemlist.getIndex(item); | ||
} | ||
} | ||
assert indexOfItem != -1; | ||
int currentQty = Itemlist.getItem(indexOfItem).getQuantity(); | ||
int newQty = getQuantity() + currentQty; | ||
new EditCommand(getItemName(), "NA", newQty, "NA", "NA", -1, | ||
-1).execute(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package command; | ||
|
||
import exceptions.CommandFormatException; | ||
|
||
public abstract class Command { | ||
|
||
public abstract void execute() throws CommandFormatException; | ||
} |
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.
I think you can add more visuals to aid in explaining your design and implementation