diff --git a/docs/AboutUs.md b/docs/AboutUs.md index fc5e82fd97..d4f7682a4a 100644 --- a/docs/AboutUs.md +++ b/docs/AboutUs.md @@ -2,8 +2,8 @@ Display | Name | Github Profile | Portfolio --------|:-------------------------:|:-------------------------------------------:|:---------: -![](./team/images/vaibhav.png) | Vaibhav Dileep Pillai | [Github](https://github.com/vibes-863) | [Portfolio](./team/vibes-863) -![](./team/images/Shyam.jpg) | Shyam Krishna Arun Gandhi | [Github](https://github.com/ShyamKrishna33) | [Portfolio](./team/shyamkrishna33) -![](./team/images/vavinan.jpg) | Jeevanandham Vavinan | [Github](https://github.com/Vavinan) | [Portfolio](./team/vavinan) -![](./team/images/isaac.jpg) | Isaac Eng | [Github](https://github.com/isaaceng7) | [Portfolio](./team/isaaceng7) +![](images/vaibhav.png) | Vaibhav Dileep Pillai | [Github](https://github.com/vibes-863) | [Portfolio](./team/vibes-863) +![](images/Shyam.jpg) | Shyam Krishna Arun Gandhi | [Github](https://github.com/ShyamKrishna33) | [Portfolio](./team/shyamkrishna33) +![](images/vavinan.jpg) | Jeevanandham Vavinan | [Github](https://github.com/Vavinan) | [Portfolio](./team/vavinan) +![](images/isaac.jpg) | Isaac Eng | [Github](https://github.com/isaaceng7) | [Portfolio](./team/isaaceng7) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 04f3fa222b..fe5aa30f61 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -7,24 +7,25 @@ original source as well} ## Design & implementation - ### Architecture -The **Architecture Diagram** of BudgetBuddy is shown below. It explains the high-level design of the application. -![](./uml/uml-images/architectureDiagram.png) + +The **Architecture Diagram** of BudgetBuddy is shown below. It explains the high-level design of the application.
+![](images/architectureDiagram.png) **Main components of the architecture:** The bulk of BudgetBuddy work is done by these following four components: + * `BudgetBuddy` class: is the main class of the application, in charge of the app launch, -shut down and reading user's inputs. It invokes the loading and saving of data when the app is launched/shut down. -* `ui` package: consists of `Ui` class, which deals with all the printing/output to the user, -and also some reading of user's inputs for additional data. + shut down and reading user's inputs. It invokes the loading and saving of data when the app is launched/shut down. +* `ui` package: consists of `Ui` class, which deals with all the printing/output to the user, + and also some reading of user's inputs for additional data. * `parser` package: consists of the `Parser` class, makes sense of the data input by the user -to provide meaningful data for other methods. + to provide meaningful data for other methods. * `storage` package: consists of `DataStorage` class, in charge of saving and loading of the `data` files. These components help to manipulate the `Transaction`, `TransactionList`, `Account` and `AccountManager` classes -which drives BudgetBuddy. +which drives BudgetBuddy.

### [Implemented] Add Account @@ -58,9 +59,49 @@ to ensure uniqueness. Finally, the method notifies the user of the successful addition of the account by displaying the details of the newly created account. +The following class diagram shows the associations between classes involved in adding an account. + +![](images/AddAccountClassDiagram.png) + The following sequence diagram shows how the add account process works: -![](./uml/uml-images/addAccountDiagram.png) +![](images/addAccountDiagram.png)

+ +### [Implemented] Remove Account + +#### Description + +This method is used to remove an existing account from the system based on the account number provided by the user +input. It checks for the existence of the account in the system, and if found, it removes the account and any associated +transactions, displaying a message indicating successful removal. This allows users to manage their accounts effectively +by removing unnecessary or outdated accounts. + +#### Parameters + +1. String input: A string containing the user input, which should include the account number to be removed, parsed using + specific delimiters. + +#### Design and Implementation + +The method begins by validating the presence of the account number in the user input. If the format is incorrect, it +throws an `InvalidArgumentSyntaxException`. If the account number is missing or the format is incorrect (not a valid +integer), a `NumberFormatException` or `EmptyArgumentException` is thrown. + +After validating and parsing the account number, it checks if removing the account would result in no accounts left, +which is not allowed. If valid, it proceeds to remove the account by the account number. It also removes any associated +transactions with this account from the transaction list, ensuring no orphan transactions remain. + +Finally, the method updates the system's account list and transaction list to reflect the removal and notifies the user +of the successful operation by displaying relevant details of the removed account and transactions. + +The following sequence diagram shows how the remove account process works: + +![](images/RemoveAccounrSequenceDiagram.png) + +**Additional Notes** +The method ensures that the system's integrity is maintained by not allowing the last account to be removed, which is +handled gracefully with appropriate user notifications. The removal process also involves updating various components of +the system to reflect the changes accurately.

### [Implemented] Category feature @@ -77,7 +118,7 @@ transaction object. This attribute is defined as a member of the `Category` enum Upon invoking the `Add` command, users are presented with a selection prompt featuring the available categories. User input, typically in the form of a numerical identifier corresponding to a category within the enum class, facilitates -the assignment of the appropriate enum object to the transaction's category attribute. +the assignment of the appropriate enum object to the transaction's category attribute.

### [Implemented] Process transaction @@ -125,7 +166,7 @@ This method adds a transaction to the list of transactions based on the necessar #### Exceptions: 1. `InvalidTransactionTypeException`: This exception is thrown when the transaction type is not one of `income` -and `expense`. + and `expense`. 2. `InvalidAddTransactionSyntax`: This exception is thrown when the syntax of the add transaction is invalid. @@ -133,11 +174,11 @@ and `expense`. The following class diagram shows the associations between classes involved in processing a transaction. -![](./uml/uml-images/TransactionListDiagram.png) +![](images/TransactionListDiagram.png) The following sequence diagram shows how an add transaction command works: -![](./uml/uml-images/addTransactionDiagram.png) +![](images/addTransactionDiagram.png)

### [Implemented] Remove transaction @@ -170,7 +211,7 @@ notifies the user of the successful removal along with displaying the details of The following sequence diagram shows how a remove transaction goes works: -![](./uml/uml-images/removeTransactionDiagram.png) +![](images/removeTransactionDiagram.png)

### [Implemented] Edit Transaction @@ -215,30 +256,32 @@ transactions while maintaining data integrity: Sequence Diagram The following sequence diagram illustrates the sequence of interactions involved in the editing of a transaction: -![](./uml/uml-images/processEditTransactionDiagram.png) - +![](images/processEditTransactionDiagram.png)

### [Implemented] Search Transactions ### Description + This method enables users to search for transactions based on a keyword. Users provide a keyword, and the system searches through transaction descriptions, amounts, categories, and dates to find matches. The search results, along with their corresponding indices in the transactions list, are displayed to the user. #### Design and Implementation + 1. **Keyword Extraction:** The method extracts the keyword from the user input. -2. **Search Process:** It iterates through the list of transactions, checking if any transaction's - description, amount, category, or date contains the keyword. Matches are added to a list of search +2. **Search Process:** It iterates through the list of transactions, checking if any transaction's + description, amount, category, or date contains the keyword. Matches are added to a list of search results along with their corresponding indices in the transactions list. -3. **Output Generation:** Once the search process is completed, the method generates output by displaying the +3. **Output Generation:** Once the search process is completed, the method generates output by displaying the search results along with their indices to the user. -4. **Exception Handling:** The method handles exceptions such as an empty keyword input or any unexpected +4. **Exception Handling:** The method handles exceptions such as an empty keyword input or any unexpected errors during the search process. Proper error messages are displayed to the user in case of exceptions. Example Algorithm: + ``` searchTransactions(input) 1. Extract the keyword from the user input. @@ -256,8 +299,8 @@ searchTransactions(input) - Print "Invalid search input." 6. Catch Exception: - Print the exception message. -``` - +``` + ### [Implemented] List Transactions ### Description @@ -268,10 +311,10 @@ specified account and transactions of a particular category. #### Design and Implementation -This feature is facilitated through the `TransactionList#processList`, and it is designed to ensure successful viewing -of the desired list as inputs are required in a bite-sized manner. +This feature is facilitated through the `TransactionList#processList`, and it is designed to ensure successful viewing +of the desired list as inputs are required in a bite-sized manner. -This method first executes the `UserInterface#printListOptions` to show users the list options and their indexes which +This method first executes the `UserInterface#printListOptions` to show users the list options and their indexes which is needed for their inputs. The method will throw an InvalidIndexException if the input is out of the range (range 1-6). Depending on the list option chosen by the user, the case statement of the `TransactionList#processList` will run, and execute the method of the corresponding option. Different methods would have different prompts as more information is @@ -281,45 +324,43 @@ from the user. Once all the required information is gathered for the particular the desired transactions will be added into that ArrayList. Then, this ArrayList will be printed out, displaying the transactions of the chosen option. -Sequence Diagram +Sequence Diagram
The following sequence diagram illustrates the sequence of interactions involved in the editing of a transaction: -![](./uml/uml-images/processList.png) - +![](images/processList.png)

### [Implemented] Insights #### Description This feature provides insights into the categorized expenses and incomes of the user. It utilizes the Insight -class to calculate and display pie charts representing the distribution of expenses and incomes across +class to calculate and display pie charts representing the distribution of expenses and incomes across different categories.
#### Design and Implementation 1. The displayCategoryInsight method iterates through the list of transactions and calculates the total income -and expense amounts for each category. It then calls the displayPieChart method to visualize these insights -using pie charts. + and expense amounts for each category. It then calls the displayPieChart method to visualize these insights + using pie charts. -2. The displayPieChart method creates separate pie charts for income and expense categories using the XChart -library. It customizes the appearance of the charts and adds series for each category with their respective -income or expense amounts. +2. The displayPieChart method creates separate pie charts for income and expense categories using the XChart + library. It customizes the appearance of the charts and adds series for each category with their respective + income or expense amounts. -3. The indexOf method is a private helper function used to find the index of a specific category within an -array -of categories. +3. The indexOf method is a private helper function used to find the index of a specific category within an + array + of categories. -4. The closeInsightFrames method is responsible for closing any open frames related to insights, specifically -targeting frames related to income and expense insights to ensure proper cleanup and resource management. +4. The closeInsightFrames method is responsible for closing any open frames related to insights, specifically + targeting frames related to income and expense insights to ensure proper cleanup and resource management. The following is the class diagram for Insights class -![](./uml/uml-images/insightDiagram.png) - - +![](images/insightDiagram.png) ## Product scope ### Target user profile: + * has a need to manage significant number of day-to-day transactions * prefer desktop apps over other types * can type fast @@ -327,6 +368,7 @@ The following is the class diagram for Insights class * is reasonably comfortable using CLI apps ### Value proposition: + * manage daily transactions faster than a typical mouse/GUI driven app ## User Stories @@ -346,13 +388,14 @@ The following is the class diagram for Insights class | v2.0 | user | Categorize my transactions | Get insights on each category | ## Non-Functional Requirements + 1. Should work on any *mainstream OS* as long as it has Java `11` or above installed. 2. A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be -able to accomplish most of the tasks faster using commands than using the mouse. + able to accomplish most of the tasks faster using commands than using the mouse. ## Glossary -* **Mainsteam OS**: Windows, Linux, Unix, MacOS +* **Mainstream OS**: Windows, Linux, Unix, macOS ## Instructions for manual testing diff --git a/docs/UserGuide.md b/docs/UserGuide.md index d851183b4a..576defc0a9 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -65,7 +65,7 @@ Adds a transaction into the transaction list of the specified account. * `add /n/New iPhone /$/2000 /c/9 /t/Expense /a/5431 /d/20-03-2024` _Successful add feature output:_
-![](./ug/successful_add_feature.png)

+![](images/successful_add_feature.png)

### View transaction history: `list` @@ -91,10 +91,10 @@ List the existing transactions. List feature includes options: * `list` followed by `6` followed by category number `CATEGORY_NUMBER` to view transactions of that category. _List feature options:_
-![](./ug/list_options.png) +![](images/list_options.png) _Successful list feature (custom date) example:_
-![](./ug/successful_list_feature.png)

+![](images/successful_list_feature.png)

### Deleting a transaction: `delete` @@ -114,7 +114,7 @@ Removes a transaction from transaction history. `delete 1` _Successful delete feature example:_ -![](./ug/successful_delete_transaction.png)

+![](images/successful_delete_transaction.png)

### Edit a transaction: `edit` @@ -138,7 +138,7 @@ Edits the details of an existing transaction. * Then the user will be asked to edit each information from that specific transaction one by one. _Successful edit feature example:_ -![](./ug/successful_edit_transaction.png)

+![](images/successful_edit_transaction.png)

### Search for a transaction: `search` @@ -164,7 +164,7 @@ Search for a list of transactions matching the keyword. * Then the user will be asked to edit each information from that specific transaction one by one. _Successful edit feature example:_
-![](./ug/successful_search.png)

+![](images/successful_search.png)

### Add an account: `add-acc` @@ -182,7 +182,7 @@ Adds a new account with a specified initial balance. `add-acc /n/DBS Savings /$/10000` _Successful add-acc feature output:_
-![](./ug/successful_add_acc_feature.png)

+![](images/successful_add_acc_feature.png)

### List all accounts: `list-acc` @@ -191,7 +191,7 @@ List all the existing accounts. **Format:** `list-acc` _Successful list-acc feature output:
_ -![](./ug/successful_list_acc_feature.png)

+![](images/successful_list_acc_feature.png)

### Delete an account: `delete-acc` @@ -209,7 +209,7 @@ Removes an account and removes all its transactions. `delete-acc 5431` _Successful delete-acc feature output:_
-![](./ug/successful_delete_acc_feature.png)

+![](images/successful_delete_acc_feature.png)

### Edit an account: `edit-acc` @@ -227,7 +227,7 @@ Edits the details of an existing account. `edit-acc 5431` _Successful edit-acc feature output:_
-![](./ug/successful_edit_acc_feature.png)

+![](images/successful_edit_acc_feature.png)

### View transaction insights: `insights` diff --git a/docs/diagrams/AddAccountClassDiagram.puml b/docs/diagrams/AddAccountClassDiagram.puml new file mode 100644 index 0000000000..31d508e0f5 --- /dev/null +++ b/docs/diagrams/AddAccountClassDiagram.puml @@ -0,0 +1,76 @@ +@startuml +skinparam classAttributeIconSize 0 +hide abstract circle +hide class circle +hide enum circle + +' Define the Account package and Account class +package budgetbuddy.account { + class Account { + -balance: double + +Account() + +Account(balance: double): void + +getBalance(): double + +setBalance(balance: double): void + } +} + +' Existing TransactionList package with new Account association +package budgetbuddy.transaction { + class TransactionList { + -transactions: ArrayList + -parser: Parser + -dataStorage: DataStorage + +TransactionList(transactions: ArrayList): void + +processTransaction(input: String, account: Account): void + +updateBalance(account: Account): void ' Added method for updating balance + } +} + +' Existing Parser package +package budgetbuddy.parser { + object Parser { + +parseUserInputToTransaction(input: String, account: Account): Transaction + } +} + +' Existing DataStorage package +package budgetbuddy.datastorage { + object DataStorage { + +saveTransactions(transactionArrayList: ArrayList): void + +getBalance(): double ' Presumed method for getting balance for an account + } +} + +' Existing Transaction Type and Category packages and classes +package budgetbuddy.transaction.type { + abstract class Transaction { + -description: String + -amount: double + -category: Category + -date: LocalDate + +Transaction(accountNumber: int, accountName: String, + description: String, amount: double, date: String) + } +} + +package budgetbuddy.categories { + enum Category <> { + +Category(categoryNum: int, categoryName: String) + +getCategoryName(): String + +getCategoryNum(): int + } +} + +' Define relationships +TransactionList -right-> "1" Parser: "uses " +TransactionList -down-> "1" DataStorage: "uses " +TransactionList ..> Transaction: "creates " +Transaction --> "1" Category: "categorized by " +Parser ..> Transaction: "parses into " +Parser ..> Category: "uses " +DataStorage ..> Account: "saves and retrieves account balance " +Account <-- TransactionList: "updated by " + +' Additional relationships for Account management might be needed depending on the context +@enduml diff --git a/docs/diagrams/RemoveAccounrSequenceDiagram.puml b/docs/diagrams/RemoveAccounrSequenceDiagram.puml new file mode 100644 index 0000000000..9bc16a582a --- /dev/null +++ b/docs/diagrams/RemoveAccounrSequenceDiagram.puml @@ -0,0 +1,28 @@ +@startuml +'https://plantuml.com/sequence-diagram + +autonumber + +actor User +participant "AccountManager" as AM +participant "Parser" as P +participant "TransactionList" as TL +participant "UserInterface" as UI + +User -> AM: removeAccount(input, TL) +AM -> AM: validateSyntax(input) +AM -> P: parseRemoveAccount(input) +activate P +P --> AM: accountNumber +deactivate P +AM -> AM: getAccountByAccountNumber(accountNumber) +AM -> TL: removeTransactionsByAccountNumber(accountNumber) +activate TL +TL --> AM: transactionsRemoved +deactivate TL +AM -> AM: removeAccount(accountNumber) +AM -> UI: printDeleteAccountMessage(removedAccount, transactionsRemoved) +activate UI +UI --> User: Display removed account message +deactivate UI +@enduml diff --git a/docs/uml/TransactionListDiagram.puml b/docs/diagrams/TransactionListDiagram.puml similarity index 100% rename from docs/uml/TransactionListDiagram.puml rename to docs/diagrams/TransactionListDiagram.puml diff --git a/docs/uml/addAccountDiagram.puml b/docs/diagrams/addAccountDiagram.puml similarity index 100% rename from docs/uml/addAccountDiagram.puml rename to docs/diagrams/addAccountDiagram.puml diff --git a/docs/uml/addTransaction.puml b/docs/diagrams/addTransaction.puml similarity index 100% rename from docs/uml/addTransaction.puml rename to docs/diagrams/addTransaction.puml diff --git a/docs/uml/insightDiagram.puml b/docs/diagrams/insightDiagram.puml similarity index 100% rename from docs/uml/insightDiagram.puml rename to docs/diagrams/insightDiagram.puml diff --git a/docs/uml/processEditTransactionDiagram.puml b/docs/diagrams/processEditTransactionDiagram.puml similarity index 100% rename from docs/uml/processEditTransactionDiagram.puml rename to docs/diagrams/processEditTransactionDiagram.puml diff --git a/docs/uml/processList.puml b/docs/diagrams/processList.puml similarity index 100% rename from docs/uml/processList.puml rename to docs/diagrams/processList.puml diff --git a/docs/uml/removeTransactionDiagram.puml b/docs/diagrams/removeTransactionDiagram.puml similarity index 100% rename from docs/uml/removeTransactionDiagram.puml rename to docs/diagrams/removeTransactionDiagram.puml diff --git a/docs/images/AddAccountClassDiagram.png b/docs/images/AddAccountClassDiagram.png new file mode 100644 index 0000000000..cda8631327 Binary files /dev/null and b/docs/images/AddAccountClassDiagram.png differ diff --git a/docs/images/RemoveAccounrSequenceDiagram.png b/docs/images/RemoveAccounrSequenceDiagram.png new file mode 100644 index 0000000000..8434f4211f Binary files /dev/null and b/docs/images/RemoveAccounrSequenceDiagram.png differ diff --git a/docs/team/images/Shyam.jpg b/docs/images/Shyam.jpg similarity index 100% rename from docs/team/images/Shyam.jpg rename to docs/images/Shyam.jpg diff --git a/docs/uml/uml-images/TransactionListDiagram.png b/docs/images/TransactionListDiagram.png similarity index 100% rename from docs/uml/uml-images/TransactionListDiagram.png rename to docs/images/TransactionListDiagram.png diff --git a/docs/uml/uml-images/addAccountDiagram.png b/docs/images/addAccountDiagram.png similarity index 100% rename from docs/uml/uml-images/addAccountDiagram.png rename to docs/images/addAccountDiagram.png diff --git a/docs/uml/uml-images/addTransactionDiagram.png b/docs/images/addTransactionDiagram.png similarity index 100% rename from docs/uml/uml-images/addTransactionDiagram.png rename to docs/images/addTransactionDiagram.png diff --git a/docs/uml/uml-images/architectureDiagram.png b/docs/images/architectureDiagram.png similarity index 100% rename from docs/uml/uml-images/architectureDiagram.png rename to docs/images/architectureDiagram.png diff --git a/docs/uml/uml-images/insightDiagram.png b/docs/images/insightDiagram.png similarity index 100% rename from docs/uml/uml-images/insightDiagram.png rename to docs/images/insightDiagram.png diff --git a/docs/team/images/isaac.jpg b/docs/images/isaac.jpg similarity index 100% rename from docs/team/images/isaac.jpg rename to docs/images/isaac.jpg diff --git a/docs/ug/list_options.png b/docs/images/list_options.png similarity index 100% rename from docs/ug/list_options.png rename to docs/images/list_options.png diff --git a/docs/uml/uml-images/processEditTransactionDiagram.png b/docs/images/processEditTransactionDiagram.png similarity index 100% rename from docs/uml/uml-images/processEditTransactionDiagram.png rename to docs/images/processEditTransactionDiagram.png diff --git a/docs/uml/uml-images/processList.png b/docs/images/processList.png similarity index 100% rename from docs/uml/uml-images/processList.png rename to docs/images/processList.png diff --git a/docs/uml/uml-images/removeTransactionDiagram.png b/docs/images/removeTransactionDiagram.png similarity index 100% rename from docs/uml/uml-images/removeTransactionDiagram.png rename to docs/images/removeTransactionDiagram.png diff --git a/docs/ug/successful_add_acc_feature.png b/docs/images/successful_add_acc_feature.png similarity index 100% rename from docs/ug/successful_add_acc_feature.png rename to docs/images/successful_add_acc_feature.png diff --git a/docs/ug/successful_add_feature.png b/docs/images/successful_add_feature.png similarity index 100% rename from docs/ug/successful_add_feature.png rename to docs/images/successful_add_feature.png diff --git a/docs/ug/successful_delete_acc_feature.png b/docs/images/successful_delete_acc_feature.png similarity index 100% rename from docs/ug/successful_delete_acc_feature.png rename to docs/images/successful_delete_acc_feature.png diff --git a/docs/ug/successful_delete_transaction.png b/docs/images/successful_delete_transaction.png similarity index 100% rename from docs/ug/successful_delete_transaction.png rename to docs/images/successful_delete_transaction.png diff --git a/docs/ug/successful_edit_acc_feature.png b/docs/images/successful_edit_acc_feature.png similarity index 100% rename from docs/ug/successful_edit_acc_feature.png rename to docs/images/successful_edit_acc_feature.png diff --git a/docs/ug/successful_edit_transaction.png b/docs/images/successful_edit_transaction.png similarity index 100% rename from docs/ug/successful_edit_transaction.png rename to docs/images/successful_edit_transaction.png diff --git a/docs/ug/successful_list_acc_feature.png b/docs/images/successful_list_acc_feature.png similarity index 100% rename from docs/ug/successful_list_acc_feature.png rename to docs/images/successful_list_acc_feature.png diff --git a/docs/ug/successful_list_feature.png b/docs/images/successful_list_feature.png similarity index 100% rename from docs/ug/successful_list_feature.png rename to docs/images/successful_list_feature.png diff --git a/docs/ug/successful_search.png b/docs/images/successful_search.png similarity index 100% rename from docs/ug/successful_search.png rename to docs/images/successful_search.png diff --git a/docs/team/images/vaibhav.png b/docs/images/vaibhav.png similarity index 100% rename from docs/team/images/vaibhav.png rename to docs/images/vaibhav.png diff --git a/docs/team/images/vavinan.jpg b/docs/images/vavinan.jpg similarity index 100% rename from docs/team/images/vavinan.jpg rename to docs/images/vavinan.jpg