Skip to content

Commit

Permalink
Merge branch 'master' into jasra_updateDG_PPP_UG
Browse files Browse the repository at this point in the history
  • Loading branch information
jasraa authored Apr 13, 2024
2 parents 98bd85b + c6e1e1f commit 34ce76c
Show file tree
Hide file tree
Showing 32 changed files with 700 additions and 423 deletions.
2 changes: 1 addition & 1 deletion data/DefaultCurrency.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Default Currency: SGD
Default Currency: USD
16 changes: 0 additions & 16 deletions data/ExpenseFile.txt
Original file line number Diff line number Diff line change
@@ -1,16 +0,0 @@
2024-04-07 | Transport | 100.00 | bus
2024-04-07 | Transport | 60.00 | train
2024-04-13 | Entertainment | 50.00 | Movie tickets
2024-04-13 | Housing | 1200.00 | Monthly rent
2024-04-13 | Groceries | 85.00 | Weekly grocery shopping
2024-04-13 | Transport | 30.00 | Bus pass
2024-04-13 | Entertainment | 75.00 | Concert ticket
2024-04-13 | Housing | 200.00 | Furniture
2024-04-13 | Groceries | 45.00 | Fresh fruits and vegetables
2024-04-13 | Transport | 70.00 | Taxi fare
2024-04-13 | Entertainment | 25.00 | Streaming service
2024-04-13 | Housing | 100.00 | Home repairs
2024-04-13 | Groceries | 110.00 | Meat and seafood
2024-04-13 | Transport | 40.00 | Petrol
2024-04-13 | Entertainment | 60.00 | Art exhibition ticket
2024-04-13 | Housing | 300.00 | Monthly parking space rental
7 changes: 0 additions & 7 deletions data/SavingsFile.txt
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
Salary | 1500.00
Investments | 500.00
Gifts | 200.00
Salary | 1000.00
Investments | 2000.00
Gifts | 250.00
Salary | 400.00
Empty file added data/SplitExpensesFile.txt
Empty file.
194 changes: 89 additions & 105 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,95 @@ currencies within the budget management application.

## 4. Implementation

### Add Expense Feature

The Add Expense Feature allows users to add expenses to different categories. `AddExpenseCommand` class enables this feature,
after initialized by the `Parser` class. Within the `AddExpense` object, the `Parser` would have initialized it with
4 variables, an `ExpenseList` object, along with a `category`, `amount` , `description`.
The relevance of these Class Attributes in `AddExpenseCommand` is as follows :

| Class Attribute | Variable Type | Relevance |
|-----------------|---------------|---------------------------------------------------|
| expenses | ExpenseList | ExpenseList Object containing the list of expenses|
| category | String | The category that the `expense` belongs to |
| amount | String | The amount spent |
| description | String | The description of the expense |


Upon the call of the `execute()` method in `BudgetBuddy` using `command.execute()`,
the `AddExpenseCommand` Object utilizes the following method from the `ExpenseList` class to add it to the existing
list of `expenses` matching against the corresponding `category`.

| Method | Return Type | Relevance |
|--------------|-------------|-------------------------------------------------|
| addExpense() | void | Add expense to the existing list of `expenses` |

The following UML Sequence diagram shows how the Parser works to obtain the relevant inputs for the Add Expense Feature :
![Sequence Diagram for Parser for Add Expense Feature](docs\diagram\sequenceDiagram_AddExpense.png)

The following is a step-by-step explanation for the Parser for the Find Feature :
1. `BudgetBuddy` calls `Parser#parseCommand(input)` with `input` being the entire user input.
E.g `add expense c/Transport a/20 d/EZ-Link Top Up`
2. Within the `Parser`, it will have determined that the `input` is a Find Command from the `isAddExpenseCommand(input)`
function.
3. The `Parser` then self calls the method `handleAddExpenseCommand(input)` with the `input` still being the entire
user input.
4. Within `AddExpenseCommand(input)`, the first check would be the check for the existence of any combination of
`c/ , a/ and d/`. If none of these combinations were found, it immediately returns `null`.
5. If the checks in `4.` is passed, Three variables would be initialized.

* | Variable Name | Variable Type |
|---------------|---------------|
| category | String |
| amount | String |
| description | String |
6. Depending on which parameters were present, the corresponding input would be extracted and placed into each variable
using the `Parser#extractDetailsForAdd(input, "parameter")`
7. Finally, `Parser#handleAddExpenseCommand()` returns a `AddExpensesCommand` to `Parser#parseCommand()`, which is
then returned to `BudgetBuddy`

### Add Savings Feature

The Add Savings Feature allows users to add savings to different categories. `AddSavingCommandCreator` class intialises the `AddSavingCommand`, after initialised by the `Parser` class. Within the `AddSavings` object, the `Parser` would have initialized it with
4 variables, a `SavingList` object, along with a `category`, `amount`.
The relevance of these Class Attributes in `AddExpenseCommand` is as follows :

| Class Attribute | Variable Type | Relevance |
|-----------------|---------------|---------------------------------------------------|
| savings | SavingList | SavingList Object containing the list of savings |
| category | String | The category that the `expense` belongs to |
| amount | String | The amount spent |

Upon the call of the `execute()` method in `BudgetBuddy` using `command.execute()`,
the `AddSavingCommand` Object utilizes the following method from the `SavingList` class to add it to the existing
list of `savings` matching against the corresponding `category`.

| Method | Return Type | Relevance |
|--------------|-------------|-------------------------------------------------|
| addSaving() | void | Add savings to the existing list of `savings` |

The following UML Sequence diagram shows how the Parser works to obtain the relevant inputs for the Add Expense Feature :
![Sequence Diagram for Parser for Add Expense Feature](docs\diagram\sequenceDiagram_AddSavings.png)

The following is a step-by-step explanation for the Parser for the Find Feature :
1. `BudgetBuddy` calls `Parser#parseCommand(input)` with `input` being the entire user input.
E.g `add savings c/Allowance a/20`
2. Within the `Parser`, it will have determined that the `input` is a Find Command from the `isAddSavingsCommand(input)`
function.
3. The `Parser` then self calls the method `handleAddExpenseCommand(input)` with the `input` still being the entire
user input.
4. Within `AddExpenseCommand(input)`, the first check would be the check for the existence of any combination of
`c/ , and a/`. If none of these combinations were found, it immediately returns `null`.
5. If the checks in `4.` is passed, two variables would be initialized.

* | Variable Name | Variable Type |
|---------------|---------------|
| category | String |
| amount | String |
6. Depending on which parameters were present, the corresponding input would be extracted and placed into each variable
using the `Parser#extractDetailsForAdd(input, "parameter")`
7. Finally, `Parser#handleAddExpenseCommand()` intialises a `AddExpensesCommandCreator` which then returns `AddSavingCommand` to `Parser#parseCommand()`, which is then returned to `BudgetBuddy`.

### Edit Expense Feature
The Edit Expense feature allows users to edit their previously added expenses, specifically the `category`, `amount`,
and `description`. This feature is managed by the `EditExpenseCommand` class, which is initialized by the
Expand Down Expand Up @@ -745,108 +834,3 @@ type fast. It also provides the ability to deal with finances on a singular plat
| v2.0 | user | view what expenses i have in each of my recurring expenses list | know what expenses i have put into each list |
| v2.0 | user | remove a list from my recurring expenses list | remove underutilized lists or wrongly added lists |


## Non-Functional Requirements

{Give non-functional requirements}

## Glossary

* *glossary item* - Definition

## Instructions for manual testing

{Give instructions on how to do a manual product testing e.g., how to load sample data to be used for testing}

### Add Expense Feature

#### Implementation

The Add Expense Feature allows users to add expenses to different categories. `AddExpenseCommand` class enables this feature,
after initialized by the `Parser` class. Within the `AddExpense` object, the `Parser` would have initialized it with
4 variables, an `ExpenseList` object, along with a `category`, `amount` , `description`.
The relevance of these Class Attributes in `AddExpenseCommand` is as follows :

| Class Attribute | Variable Type | Relevance |
|-----------------|---------------|---------------------------------------------------|
| expenses | ExpenseList | ExpenseList Object containing the list of expenses|
| category | String | The category that the `expense` belongs to |
| amount | String | The amount spent |
| description | String | The description of the expense |


Upon the call of the `execute()` method in `BudgetBuddy` using `command.execute()`,
the `AddExpenseCommand` Object utilizes the following method from the `ExpenseList` class to add it to the existing
list of `expenses` matching against the corresponding `category`.

| Method | Return Type | Relevance |
|--------------|-------------|-------------------------------------------------|
| addExpense() | void | Add expense to the existing list of `expenses` |

The following UML Sequence diagram shows how the Parser works to obtain the relevant inputs for the Add Expense Feature :
![Sequence Diagram for Parser for Add Expense Feature](docs\diagram\sequenceDiagram_AddExpense.png)

The following is a step-by-step explanation for the Parser for the Find Feature :
1. `BudgetBuddy` calls `Parser#parseCommand(input)` with `input` being the entire user input.
E.g `add expense c/Transport a/20 d/EZ-Link Top Up`
2. Within the `Parser`, it will have determined that the `input` is a Find Command from the `isAddExpenseCommand(input)`
function.
3. The `Parser` then self calls the method `handleAddExpenseCommand(input)` with the `input` still being the entire
user input.
4. Within `AddExpenseCommand(input)`, the first check would be the check for the existence of any combination of
`c/ , a/ and d/`. If none of these combinations were found, it immediately returns `null`.
5. If the checks in `4.` is passed, Three variables would be initialized.

* | Variable Name | Variable Type |
|---------------|---------------|
| category | String |
| amount | String |
| description | String |
6. Depending on which parameters were present, the corresponding input would be extracted and placed into each variable
using the `Parser#extractDetailsForAdd(input, "parameter")`
7. Finally, `Parser#handleAddExpenseCommand()` returns a `AddExpensesCommand` to `Parser#parseCommand()`, which is
then returned to `BudgetBuddy`

### Add Savings Feature

#### Implementation

The Add Savings Feature allows users to add savings to different categories. `AddSavingCommandCreator` class intialises the `AddSavingCommand`, after initialised by the `Parser` class. Within the `AddSavings` object, the `Parser` would have initialized it with
4 variables, a `SavingList` object, along with a `category`, `amount`.
The relevance of these Class Attributes in `AddExpenseCommand` is as follows :

| Class Attribute | Variable Type | Relevance |
|-----------------|---------------|---------------------------------------------------|
| savings | SavingList | SavingList Object containing the list of savings |
| category | String | The category that the `expense` belongs to |
| amount | String | The amount spent |

Upon the call of the `execute()` method in `BudgetBuddy` using `command.execute()`,
the `AddSavingCommand` Object utilizes the following method from the `SavingList` class to add it to the existing
list of `savings` matching against the corresponding `category`.

| Method | Return Type | Relevance |
|--------------|-------------|-------------------------------------------------|
| addSaving() | void | Add savings to the existing list of `savings` |

The following UML Sequence diagram shows how the Parser works to obtain the relevant inputs for the Add Expense Feature :
![Sequence Diagram for Parser for Add Expense Feature](docs\diagram\sequenceDiagram_AddSavings.png)

The following is a step-by-step explanation for the Parser for the Find Feature :
1. `BudgetBuddy` calls `Parser#parseCommand(input)` with `input` being the entire user input.
E.g `add savings c/Allowance a/20`
2. Within the `Parser`, it will have determined that the `input` is a Find Command from the `isAddSavingsCommand(input)`
function.
3. The `Parser` then self calls the method `handleAddExpenseCommand(input)` with the `input` still being the entire
user input.
4. Within `AddExpenseCommand(input)`, the first check would be the check for the existence of any combination of
`c/ , and a/`. If none of these combinations were found, it immediately returns `null`.
5. If the checks in `4.` is passed, two variables would be initialized.

* | Variable Name | Variable Type |
|---------------|---------------|
| category | String |
| amount | String |
6. Depending on which parameters were present, the corresponding input would be extracted and placed into each variable
using the `Parser#extractDetailsForAdd(input, "parameter")`
7. Finally, `Parser#handleAddExpenseCommand()` intialises a `AddExpensesCommandCreator` which then returns `AddSavingCommand` to `Parser#parseCommand()`, which is then returned to `BudgetBuddy`.
39 changes: 28 additions & 11 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,31 +58,45 @@ Example of usage:
`menu 1` : Displays commands related to feature associated to menu list item 1

### Add Expense
Adds new expense
Records a new expense under a specific category with a detailed description.

Format: `add expense c/CATEGORY a/AMOUNT d/DESCRIPTION`

* Increments expense of the specified CATEGORY by AMOUNT given.
* The `CATEGORY` must be one of the following pre-defined categories: "Housing",
"Groceries", "Utility", "Transport", "Entertainment" or "Others".
* The `AMOUNT` must be a positive integer.
* The `DESCRIPTION` can be any string.
* The category under which the expense is to be recorded. It must match one of the
pre-defined categories exactly (not case-insensitive):
Housing
Groceries
Utility
Transport
Entertainment
Others
* The `AMOUNT` is the amount to add to the expense. It must be a positive number and can include
up to two decimal places.
* The `DESCRIPTION` is a brief description of the expense. Accepts any text string.

Example of Usage:

`add expense c/Entertainment a/167 d/Bruno Mars`


### Add Savings
Increase savings by specified amount to the savings list
Adds a specified amount to the savings under a particular category.

Format: `add savings c/CATEGORY a/AMOUNT`

* Increments savings of the specified CATEGORY by AMOUNT given.
* The `CATEGORY` must be one of the following pre-defined categories: "Salary",
"Investments", "Gifts" or "Others".
* The `AMOUNT` must be a positive integer.
* The `DESCRIPTION` can be any string.
* The category for the savings increment. It must be one of the pre-defined
categories (not case-insensitive):
Salary
Investments
Gifts
Others
* The `AMOUNT` is the amount to add to the savings. It must be a positive number
and can include up to two decimal places.

Example of Usage:

`add savings c/Salary a/500.50`

### Add Split Expenses
Add expenses that are meant for splitting among friends or colleague
Expand Down Expand Up @@ -254,6 +268,9 @@ Format `settle i/Index`
* The system will settle the splitted expense corresponding to `Index`
* `Index` must be a positive integer

Example of usage:
`settle i/2`: Delete splitexpense of index 2 listed in splittedexpenses tracker

### Finding expenses : `find expenses`

Finds expenses based on their description or amount
Expand Down
Binary file removed docs/diagrams/SequenceDiagram_addSavings.png
Binary file not shown.
Binary file added docs/diagrams/sequenceDiagram_AddExpense.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/diagrams/sequenceDiagram_AddExpense.png
Binary file not shown.
Binary file added docs/diagrams/sequenceDiagram_AddSaving.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/diagrams/sequenceDiagram_SplitExpense.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docs/team/yyangdaa.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,21 @@ docs~functional-code~test-code~other)

#### Enhancements to existing features:
1. Wrote JUnit tests for the ExpenseList, SavingsList, SplitExpenseList and Parser.
- Implemented Logging/Assertions for improved error handling. (Pull Requests : [#45](https://github.com/AY2324S2-CS2113-T12-3/tp/pull/45),
[#56](https://github.com/AY2324S2-CS2113-T12-3/tp/pull/56)).

#### Developer Guide
- Added implementation details of the `AddExpense`, `AddSaving` and `SplitExpense` feature. (Pull Requests : [#207](https://github.com/AY2324S2-CS2113-T12-3/tp/pull/207)).
- Added design details of the `AddExpense`, `AddSaving`, `SplitExpense`, `SplitExpenseList` and `SettleSplitExpenseList` classes.
(Pull Requests : [#207](https://github.com/AY2324S2-CS2113-T12-3/tp/pull/207)).
- Added user stories for my respective features. (Pull Requests : [#207](https://github.com/AY2324S2-CS2113-T12-3/tp/pull/207)).
- Added Sequence Diagrams for `AddExpense`, `AddSaving` and `SplitExpense` features. (Pull Requests : [#207](https://github.com/AY2324S2-CS2113-T12-3/tp/pull/207)).

### Community

#### Reported Bugs and Suggestions for Other Teams
- Provided 4 DG Peer Review Comments for another team. ([Team #1](https://github.com/nus-cs2113-AY2324S2/tp/pull/25)).
- Reported 5 Bugs for another team during PE-D. ([Team #1](https://github.com/nus-cs2113-AY2324S2/tp/pull/54)).

### Tools
- Usage of Draw.io for my Sequence Diagrams. ([Draw.io](https://draw.io/)).
4 changes: 4 additions & 0 deletions src/main/java/seedu/budgetbuddy/BudgetBuddy.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class BudgetBuddy {
private Storage expensesStorage;
private Storage savingsStorage;
private Storage recurringExpensesStorage;
private Storage splitexpensesStorage;
private Storage defaultCurrency;


Expand All @@ -35,6 +36,7 @@ public BudgetBuddy() {
expensesStorage = new Storage("./data/ExpenseFile.txt");
savingsStorage = new Storage("./data/SavingsFile.txt");
recurringExpensesStorage = new Storage("./data/RecurringExpensesFile.txt");
splitexpensesStorage = new Storage("./data/SplitExpensesFile.txt");
defaultCurrency = new Storage("./data/DefaultCurrency.txt");

}
Expand All @@ -53,6 +55,7 @@ public void handleCommands(String input) {
expensesStorage.saveExpenses(expenses.getExpenses());
savingsStorage.saveSavings(savings.getSavings());
recurringExpensesStorage.saveRecurringExpenses(recurringExpenseLists);
splitexpensesStorage.saveSplitExpenses(splitexpenses.getSplitExpenses());

defaultCurrency.saveCurrency();
} catch (IOException e) {
Expand All @@ -71,6 +74,7 @@ public void run() {
defaultCurrency.loadCurrency();
this.expenses.getExpenses().addAll(expensesStorage.loadExpenses());
this.savings.getSavings().addAll(savingsStorage.loadSavings());
this.splitexpenses.getSplitExpenses().addAll(splitexpensesStorage.loadSplitExpenses());
this.recurringExpenseLists = recurringExpensesStorage.loadRecurringExpensesList();


Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/budgetbuddy/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ public Command parseCommand(ExpenseList expenses, SavingList savings, SplitExpen
}

if (isConvertCurrencyCommand(input.toLowerCase())) {
CommandCreator commandCreator = new ChangeCurrencyCommandCreator(input, savings, expenses, expensesList,
new CurrencyConverter());
CommandCreator commandCreator = new ChangeCurrencyCommandCreator(input, savings, expenses, splitexpenses,
expensesList, new CurrencyConverter());
return commandCreator.createCommand();
}

Expand Down
Loading

0 comments on commit 34ce76c

Please sign in to comment.