Skip to content

Commit

Permalink
Merge pull request #205 from itsmejr257/junRong-DG-Update
Browse files Browse the repository at this point in the history
Add updates to Documentation, Developer Guide, User Guide and ReadMe
  • Loading branch information
itsmejr257 authored Apr 13, 2024
2 parents b6c9284 + 0f324b4 commit 4a7a2e9
Show file tree
Hide file tree
Showing 24 changed files with 302 additions and 210 deletions.
70 changes: 9 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,12 @@
# BudgetBuddy
BudgetBuddy is a product for users who wish to handle and track any current/future expenses on a singular platform.
BudgetBuddy provides a faster and more efficient way to track and calculate expenses and provides the ability
to deal with finances on a singular platform with ease as long as you can type fast.

This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.
Useful Links :
* [User Guide](docs/UserGuide.md)
* [Developer Guide](docs/DeveloperGuide.md)
* [About Us](docs/AboutUs.md)

## Setting up in Intellij

Prerequisites: JDK 11 (use the exact version), update Intellij to the most recent version.

1. **Ensure Intellij JDK 11 is defined as an SDK**, as described [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk) -- this step is not needed if you have used JDK 11 in a previous Intellij project.
1. **Import the project _as a Gradle project_**, as described [here](https://se-education.org/guides/tutorials/intellijImportGradleProject.html).
1. **Verify the set up**: After the importing is complete, locate the `src/main/java/seedu/duke/Duke.java` file, right-click it, and choose `Run Duke.main()`. If the setup is correct, you should see something like the below:
```
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :Duke.main()
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
What is your name?
```
Type some word and press enter to let the execution proceed to the end.

## Build automation using Gradle

* This project uses Gradle for build automation and dependency management. It includes a basic build script as well (i.e. the `build.gradle` file).
* If you are new to Gradle, refer to the [Gradle Tutorial at se-education.org/guides](https://se-education.org/guides/tutorials/gradle.html).

## Testing

### I/O redirection tests

* To run _I/O redirection_ tests (aka _Text UI tests_), navigate to the `text-ui-test` and run the `runtest(.bat/.sh)` script.

### JUnit tests

* A skeleton JUnit test (`src/test/java/seedu/duke/DukeTest.java`) is provided with this project template.
* If you are new to JUnit, refer to the [JUnit Tutorial at se-education.org/guides](https://se-education.org/guides/tutorials/junit.html).

## Checkstyle

* A sample CheckStyle rule configuration is provided in this project.
* If you are new to Checkstyle, refer to the [Checkstyle Tutorial at se-education.org/guides](https://se-education.org/guides/tutorials/checkstyle.html).

## CI using GitHub Actions

The project uses [GitHub actions](https://github.com/features/actions) for CI. When you push a commit to this repo or PR against it, GitHub actions will run automatically to build and verify the code as updated by the commit/PR.

## Documentation

`/docs` folder contains a skeleton version of the project documentation.

Steps for publishing documentation to the public:
1. If you are using this project template for an individual project, go your fork on GitHub.<br>
If you are using this project template for a team project, go to the team fork on GitHub.
1. Click on the `settings` tab.
1. Scroll down to the `GitHub Pages` section.
1. Set the `source` as `master branch /docs folder`.
1. Optionally, use the `choose a theme` button to choose a theme for your documentation.
Contributors :
*[Chan Jun Rong](docs/team/itsmejr257.md)
372 changes: 237 additions & 135 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

28 changes: 21 additions & 7 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,14 @@ Finds expenses based on their description or amount

Format : `find expenses d/DESCRIPTION morethan/MINAMOUNT lessthan/MAXAMOUNT`

* All prefixes `d/`, `morethan/` and `lessthan` **must be** present
* All prefixes `d/`, `morethan/` and `lessthan/` **must be** present
* `DESCRIPTION`, `MINAMOUNT`, `MAXAMOUNT` are optional to use as long as *at least* one parameter used.
* Leaving either `DESCRIPTION`, `MINAMOUNT`, `MAXAMOUNT` empty assumes that the parameter is not considered when finding expenses
* `DESCRIPTION` is the description associated with the expenses the user wishes to find
* `MINAMOUNT` is the filter for expenses with amounts higher than specified value
* `MAXAMOUNT` is the filter for expenses with amounts lower than specified value
* `MINAMOUNT` is the filter for expenses with amounts higher than or equal to the specified value
* `MAXAMOUNT` is the filter for expenses with amounts lower than or equal to the specified value
* **Note** Although the user is able to combine the prefixes without any spaces, etc.
`find expenses d/descriptionmorethan/10lessthan/20`, it is strongly recommended to ensure spaces for clarity.

Examples of usage :

Expand All @@ -293,11 +295,11 @@ Examples of usage :
### Recurring Bill Description
The next few features in the user guide would be related to the Recurring Bill Feature. The commands associated to
this overall feature would start with the `rec` command, followed by the relevant `commandType` and parameters. This
feature allows user to create and manage multiple lists of expenses **separate** from the user's overall expenses
feature allows the user to create and manage multiple lists of expenses **separate** from the user's overall expenses
, which can be added to the users overall expenses.

The term **recurring** here is to indicate that a user is able to **add** a set of pre-defined expenses to their
overall expenses at any given point in time. Hence, this could range from subscription payments, a future grocery list,
overall expenses at **any** given point in time. Hence, this could range from subscription payments, a future grocery list,
etc.


Expand All @@ -324,7 +326,7 @@ Format : `rec viewlists`

* This command is **space sensitive**, in particular, the space between `rec` and `viewlists` must be
**exactly** one space apart for the command to be recognised
* **Note** Anything typed after `rec viewlists` will be ignored.
* **Note** Anything typed after `rec viewlists ` will be ignored.

Examples of Output :

Expand Down Expand Up @@ -383,6 +385,13 @@ Format : `rec viewexpenses LISTNUMBER`
Examples of usage :
`rec viewexpenses 1` : Prints all expenses in the 1st recurring bill

Here are some expected outputs for different situations :

When the list to view contains expenses : ![View Expenses Command when List is Non-Empty](userguideimages/rec_viewexpenses_NonEmptyList.png)


When the list to view does not contain any expenses : ![View Expenses Command when List is Empty](userguideimages/rec_viewexpenses_EmptyList.png)

### Add expenses in a recurring bill to overall expenses : `rec addrec`

Adds all expenses in a specified recurring bill to the overall expenses
Expand All @@ -397,6 +406,11 @@ overall list of expenses
Examples of usage :
`rec addrec 1` : Adds all expenses in the 1st recurring bill into the overall expenses

Here are some expected outputs for different situations :

When the list to add contains expenses : ![Add Recurring Expenses Command when List is Non-Empty](userguideimages/rec_addrec_NonEmptyList.png)

When the list to add is empty: ![Add Recurring Expenses Command when List is Non-Empty](userguideimages/rec_addrec_EmptyList.png)

### Changing Currencies : `change currency [CURRENCY_CODE]`

Expand Down Expand Up @@ -510,7 +524,7 @@ Advanced users are welcome to update the data directly by editing this file. How
* Edit Savings `edit savings c/CATEGORY i/INDEX a/AMOUNT`
* List Expenses: `list expenses [CATEGORY]`
* List Savings: `list savings [CATEGORY]`
* Find Expenses `find expenses [d/DESCRIPTION] [morethan/MINAMOUNT] [lessthan/MAXAMOUNT]`
* Find Expenses `find expenses d/DESCRIPTION morethan/MINAMOUNT lessthan/MAXAMOUNT`
* Change Currency `change currency [CURRENCY_CODE]`
* Set Budget `set budget c/CATEGORY b/BUDGET`
* Get Budget `get budget c/CATEGORY`
Expand Down
Binary file removed docs/diagrams/Introduction.jpg
Binary file not shown.
Binary file removed docs/diagrams/RecurringExpensesListClassDiagram.jpg
Binary file not shown.
Binary file removed docs/diagrams/SequenceDiagram_FindExpenses.jpg
Binary file not shown.
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/diagram_Introduction.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 not shown.
Binary file removed docs/diagrams/sequenceDiagram-MenuCommandCreator.jpg
Binary file not shown.
Binary file added docs/diagrams/sequenceDiagram_Command.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/diagrams/sequenceDiagram_MenuCommand.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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_RecurringExpenses.jpg
Binary file not shown.
Binary file added docs/userguideimages/rec_addrec_EmptyList.png
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/userguideimages/rec_addrec_NonEmptyList.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions src/main/java/seedu/budgetbuddy/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ public void resetSavingsListFile() throws IOException {
writer.close();
}

/**
* Deletes the existing recurring expenses file and create a new, empty file.
* This method is used to reset the recurring expenses file when it has been detected to be corrupted
*
* @throws IOException If there is an error deleting the old file or creating the new file
*/
public void resetRecurringExpensesListFile() throws IOException {
File file = new File(filePath);
file.delete();
Expand All @@ -247,6 +253,16 @@ public void resetRecurringExpensesListFile() throws IOException {
writer.close();
}

/**
* Parses a line of text from the recurring expenses file, adding either a recurring expense list, or an expense
* into a recurring expense list. If the line begins with a `!!!`, it adds a recurring Expense List with the name
* being the string between the two `!!!`. Else, the line contains details on an individual expense
* and adds the expense to the specified list number
*
* @param recurringExpenses The list of ExpenseLists to which the parsed data will be added to
* @param line The line of text to be parsed
* @throws BudgetBuddyException If the format of the line is corrupted
*/
public void parseRecurringExpensesFile(ArrayList<ExpenseList> recurringExpenses, String line)
throws BudgetBuddyException{

Expand Down Expand Up @@ -291,6 +307,13 @@ public void parseRecurringExpensesFile(ArrayList<ExpenseList> recurringExpenses,
}

}

/**
* Loads the recurring expenses from a file into a RecurringExpenseLists object.
*
* @return RecurringExpenseLists containing all parsed recurring expenses from the file.
* @throws IOException If there is an error when reading the file
*/
public RecurringExpenseLists loadRecurringExpensesList() throws IOException{
File file = new File(filePath);
ArrayList<ExpenseList> recurringExpenses = new ArrayList<>();
Expand Down Expand Up @@ -320,6 +343,14 @@ public RecurringExpenseLists loadRecurringExpensesList() throws IOException{

}

/**
* Saves the details of recurring expenses into a file from a provided RecurringExpenseLists object.
*
* @param recurringExpenseLists The RecurringExpenseLists object containing all expense lists and expenses to be
* saved
* @throws InvalidRecurringExpensesFileException If the saving of the file was not successful
* @throws IOException If an error occurs when validating whether the RecurringExpensesFile.txt exists
*/
public void saveRecurringExpenses(RecurringExpenseLists recurringExpenseLists)
throws InvalidRecurringExpensesFileException, IOException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private void addExpenseToList(int listNumber, String category, Double amount, St
System.out.println("|Details of Expense");
System.out.println("--------------------");
System.out.println("|Category : " + category);
System.out.println("|Amount : " + amount);
System.out.println("|Amount : " + String.format("%.2f", amount));
System.out.println("|Description : " + description);
ui.printDivider();

Expand Down Expand Up @@ -199,7 +199,7 @@ private void addRecurringExpensesToExpenses(int listNumber, RecurringExpenseList
if (expenses.isEmpty()) {
ui.printDivider();
System.out.println("There are no expenses present in \"" + expenseList.getName() +
"\" nothing has been added to the overall expenses");
"\". Nothing has been added to the overall expenses");
ui.printDivider();
return;
}
Expand All @@ -215,7 +215,7 @@ private void addRecurringExpensesToExpenses(int listNumber, RecurringExpenseList
}

ui.printDivider();
System.out.println("You Recurring Expenses in " + expenseList.getName() +
System.out.println("Your Recurring Expenses in " + expenseList.getName() +
" has been added to your overall Expenses");
ui.printDivider();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ public void convertSavingCurrency(Currency newCurrency, SavingList savings) {
}

public void convertRecurringExpensesCurrency(Currency newCurrency, RecurringExpenseLists recurringExpenseLists) {
if (recurringExpenseLists == null) {

throw new IllegalArgumentException("SavingList cannot be null");
}
assert recurringExpenseLists != null : "RecurringExpenseLists cannot be null";

if (DefaultCurrency.getDefaultCurrency() == newCurrency) {
System.out.println("Same currency for Recurring Expenses. No Conversion needed");
Expand Down

0 comments on commit 4a7a2e9

Please sign in to comment.