Skip to content

Commit

Permalink
Merge pull request #231 from yyangdaa/master
Browse files Browse the repository at this point in the history
Final change
  • Loading branch information
yyangdaa authored Apr 14, 2024
2 parents ee68cf5 + c029d01 commit ce7c229
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ list of `savings` matching against the corresponding `category`.
| 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.jpg)
![Sequence Diagram for Parser for Add Expense Feature](docs\diagram\sequenceDiagram_AddSaving.jpg)

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.
Expand Down Expand Up @@ -453,10 +453,10 @@ Class Attributes for SplitExpenseCommand:

| Class Attribute | Variable Type | Relevance |
|-------------------|-------------------|--------------------------------------------------------------|
| splitExpenseList | SplitExpenseList | SplitExpenseList O bject where the shared bill will be added | |
| amount | double | The total amount of the shared bill |
| splitExpenseList | SplitExpenseList | SplitExpenseList O bject where the shared bill will be added |
| amount | double | The total amount of the shared bill |
| numerOfPeople | int | The number of people that are meant for splitting the bill |
| description | String | Description of the shared bill |
| description | String | Description of the shared bill |

Upon the call of the execute() method via command.execute(), SplitExpenseCommand performs the following key actions:

Expand Down
13 changes: 11 additions & 2 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ Example of Usage:

`add savings c/Salary a/500.50`

### Add Shared Bill
Add bills that are meant for splitting among friends or colleague
### 3.4 Add Shared Bill
Add bills that are meant for splitting among friends or colleague

Expand Down Expand Up @@ -552,11 +550,22 @@ As our program does not require Internet access, the conversion ratios are taken
* Display Commands : `menu INDEX`
* Add Savings: `add savings c/CATEGORY a/AMOUNT`
* Add Expense: `add expense c/CATEGORY a/AMOUNT d/DESCRIPTION`
* Add Shared Bill: `a/AMOUNT n/NUMBER_OF_PEOPLE d/DESCRIPTION`
* Edit Expenses `edit expense c/CATEGORY i/INDEX a/AMOUNT d/DESCRIPTION`
* Edit Savings `edit savings c/CATEGORY i/INDEX a/AMOUNT`
* Reduce Savings `educe savings i/INDEX a/AMOUNT`
* Delete Expense `delete expense i/INDEX`
* List Expenses: `list expenses [CATEGORY]`
* List Savings: `list savings [CATEGORY]`
* Find Expenses `find expenses d/DESCRIPTION morethan/MINAMOUNT lessthan/MAXAMOUNT`
* Check Splitted Expenses `check split bills`
* Settle Bill `settle bill i/Index`
* Add Recurring Bill `rec newlist LISTNAME`
* List all Recurring Bills `rec viewlists`
* Remove Reccuring Bill `rec removelist LISTNUMBER`
* Add an expense to a recurring bill `rec newexpense to/LISTNUMBER c/CATEGORY a/AMOUNT d/DESCRIPTION`
* View expenses in a recurring bill `rec viewexpenses LISTNUMBER`
* Add expenses in a recurring bill to overall expenses `rec addrec LISTNUMBER`
* Change Currency `change currency [CURRENCY_CODE]`
* Set Budget `set budget c/CATEGORY b/BUDGET`
* Get Budget `get budget c/CATEGORY`
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/seedu/budgetbuddy/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,13 @@ public void saveCurrency() throws IOException {
}
}

//@@author yyangdaa
/**
* Loads the split expenses from the specified file path.
*
* @return A list of {@link SplitExpense} objects loaded from the file.
* @throws FileNotFoundException If the file does not exist.
*/
public List<SplitExpense> loadSplitExpenses() throws FileNotFoundException {
File file = new File(filePath);
List<SplitExpense> splitExpenses = new ArrayList<>();
Expand All @@ -456,6 +463,13 @@ public List<SplitExpense> loadSplitExpenses() throws FileNotFoundException {
}


//@@author yyangdaa
/**
* Saves the list of split expenses to the specified file path.
*
* @param splitExpenses A list of {@link SplitExpense} objects to save to the file.
* @throws IOException If an error occurs during writing to the file.
*/
public void saveSplitExpenses(List<SplitExpense> splitExpenses) throws IOException {
ensureDirectoryExists();

Expand Down
6 changes: 6 additions & 0 deletions src/test/java/seedu/budgetbuddy/ExpenseListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ExpenseListTest {

private static final Logger LOGGER = Logger.getLogger(ExpenseListTest.class.getName());

//@@author yyangdaa
@Test
public void calculateTotalExpenses_addingIntegers_success() throws BudgetBuddyException {
ExpenseList expenseList = new ExpenseList();
Expand All @@ -32,6 +33,7 @@ public void calculateTotalExpenses_addingIntegers_success() throws BudgetBuddyEx
assertEquals(80, expenseList.calculateTotalExpenses());
}

//@@author yyangdaa
@Test
public void addExpense_addingExpense_success() throws BudgetBuddyException {
ExpenseList expenseList = new ExpenseList();
Expand All @@ -43,6 +45,7 @@ public void addExpense_addingExpense_success() throws BudgetBuddyException {
assertEquals("Bus Fare", expenseList.getExpenses().get(0).getDescription());
}

//@@author yyangdaa
@Test
public void addExpense_addingNegativeExpense_exceptionThrown() {
ExpenseList expenseList = new ExpenseList();
Expand All @@ -55,6 +58,7 @@ public void addExpense_addingNegativeExpense_exceptionThrown() {
}
}

//@@author yyangdaa
@Test
public void addExpense_addingInvalidAmount_exceptionThrown() {
ExpenseList expenseList = new ExpenseList();
Expand All @@ -67,6 +71,7 @@ public void addExpense_addingInvalidAmount_exceptionThrown() {
}
}

//@@author yyangdaa
@Test
public void addExpense_addingNullCategory_exceptionThrown() {
ExpenseList expenseList = new ExpenseList();
Expand All @@ -78,6 +83,7 @@ public void addExpense_addingNullCategory_exceptionThrown() {
}
}

//@@author yyangdaa
@Test
public void deleteExpense_validInput_success() throws BudgetBuddyException {
// Create an ExpenseList and add two expenses
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/seedu/budgetbuddy/SavingListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class SavingListTest {
private static final Logger LOGGER = Logger.getLogger(SavingListTest.class.getName());


//@@author yyangdaa
@Test
public void addSaving_validInput_success() throws BudgetBuddyException {
SavingList savingList = new SavingList();
Expand All @@ -29,6 +30,7 @@ public void addSaving_validInput_success() throws BudgetBuddyException {
assertEquals(500, savingList.getSavings().get(0).getAmount());
}

//@@author yyangdaa
@Test
public void addSaving_invalidAmount_exceptionThrown() {
SavingList savingList = new SavingList();
Expand All @@ -40,6 +42,7 @@ public void addSaving_invalidAmount_exceptionThrown() {
}
}

//@@yyangdaa
@Test
public void addSaving_negativeAmount_exceptionThrown() {
SavingList savingList = new SavingList();
Expand All @@ -51,6 +54,7 @@ public void addSaving_negativeAmount_exceptionThrown() {
}
}

//@@yyangdaa
@Test
public void addSaving_nullCategory_exceptionThrown() {
SavingList savingList = new SavingList();
Expand Down

0 comments on commit ce7c229

Please sign in to comment.