diff --git a/docs/UserGuide.md b/docs/UserGuide.md index d898dde525..6bbd2279f4 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -5,6 +5,18 @@ * [Introduction](#introduction) * [Quick start](#quick-start) * [Features](#features) + * [Add cashflow](#add-cashflow) + * [Add income](#add-income-add-income) + * [Add expense](#add-expense-add-expense) + * [Delete cashflow](#delete-cashflow-delete) + * [Delete income](#delete-income-delete-income) + * [Delete expense](#delete-expense-delete-expense) + * [Delete recurring cashflow](#delete-recurring-delete-recurring) + * [List](#list) + * [List all](#list-all-list) + * [List income](#list-income-list-income) + * [List expense](#list-expense-list-expense) + * [List recurring](#list-recurring-list-recurring) * [Budget](#budget) * [Setting budget](#setting-a-budget-budget-set) * [Updating budget](#updating-budget-budget-update) @@ -34,11 +46,308 @@ you a one-stop interface to access a plethora of features to manage your finance {Give steps to get started quickly} 1. Ensure that you have Java 11 or above installed. -1. Down the latest version of `Duke` from [here](http://link.to/duke). +2. Download the latest version of `Financial Planner` from [here](http://link.to/duke). +3. Copy the file to the folder you want to use as the *home folder* for Financial Planner. +4. Open a command terminal, `cd` into the folder you put the jar file in, and use the `java -jar ip.jar` command to run the application. +5. Refer to the **Features** section below for details of each command. ## Features {Give detailed description of each feature} +### Notes about the command format +- Words in `UPPER_CASE` are parameters to be supplied by the user. + + e.g. in `add income /a AMOUNT`, `AMOUNT` is a parameter which can be used as `add income /a 100`. +- Items in square brackets are optional. + + e.g. `[/r DAYS]` can be used as `/r 30` or left empty. + +### Add cashflow + +#### Add income: `add income` +Adds an income source to the Financial Planner. + +Format: `add income /a AMOUNT /t TYPE [/r DAYS] [/d DESCRIPTION]` + +- `/r` is used to denote a recurring income, with the period to the next addition is specified by `DAYS`. +- `/d` is used to give a description to the income. +- `/t` is used to specify the income type, where the list of acceptable types is given below + +| Income Types | +|---------------| +| `salary` | +| `investments` | +| `allowance` | +| `others` | + +Example of usage: `add income /a 5000 /t salary /r 30 /d work` + +Example output: + +``` +You have added an Income + Type: Salary + Amount: 5000.00 + Recurring every: 30 days, starting from: Oct 30 2023 + Description: work +to the Financial Planner. +Balance: 5000.00 +``` +- Note: Balance displayed above is just an example. Your actual balance may differ. +#### Add expense: `add expense` +Adds an expense to the Financial Planner + +Format: `add expense /a AMOUNT /t TYPE [/r DAYS] [/d DESCRIPTION]` + +- `/r` is used to denote a recurring expense, with the period to the next addition is specified by `DAYS`. +- `/d` is used to give a description to the expense. +- `/t` is used to specify the expense type, where the list of acceptable types is given below + +| Expense | +|-----------------| +| `dining` | +| `entertainment` | +| `shopping` | +| `travel` | +| `insurance` | +| `necessities` | +| `others` | + +Example of usage: `add expense /a 300 /t necessities /r 30 /d groceries` + +Example output: +``` +You have added an Expense + Type: Necessities + Amount: 300.00 + Recurring every: 30 days, starting from: Oct 30 2023 + Description: groceries +to the Financial Planner. +Balance: 4700.00 +``` +- Note: Balance displayed above is just an example. Your actual balance may differ. +### Delete cashflow: `delete` +Deletes a cashflow from the Financial Planner. + +Format: `delete INDEX [/r]` + +- `INDEX` refers to the index number shown in the displayed list when [`list`](#list-all-list) command is used. +- `/r` is used to delete all **future** cashflows **only**. + +Example of usage: `delete 1 /r` + +Example output: +``` +You have removed future recurrences of this cashflow. +Updated cashflow: +Income + Type: Salary + Amount: 5000.00 + Description: work +``` +Example of usage: `delete 1` + +Example output: +``` +You have removed an Income + Type: Salary + Amount: 5000.00 + Description: work +from the Financial Planner. +Balance: -1130.00 +``` +- Note: Balance displayed above is just an example. Your actual balance may differ. + +#### Delete income: `delete income` +Deletes an income from the Financial Planner. + +Format: `delete income INDEX [/r]` + +- `INDEX` refers to the index number shown in the displayed list when [`list income`](#list-income-list-income) command is used. +- `/r` is used to delete all **future** incomes **only**. + +Example of usage: `delete income 2 /r` + +Example output: +``` +You have removed future recurrences of this cashflow. +Updated cashflow: +Income + Type: Allowance + Amount: 500.00 + Description: parents +``` +Example of usage: `delete income 2` + +Example output: +``` +You have removed an Income + Type: Allowance + Amount: 500.00 + Description: parents +from the Financial Planner. +Balance: 5170.00 +``` +- Note: Balance displayed above is just an example. Your actual balance may differ. + +#### Delete expense: `delete expense` +Deletes an expense from the Financial Planner. + +Format: `delete expense INDEX [/r]` + +- `INDEX` refers to the index number shown in the displayed list when [`list expense`](#list-expense-list-expense) command is used. +- `/r` is used to delete all **future** expenses **only**. + +Example of usage: `delete expense 2 /r` + +Example output: +``` +You have removed future recurrences of this cashflow. +Updated cashflow: +Expense + Type: Insurance + Amount: 800.00 + Description: ntuc income +``` +Example of usage: `delete expense 2` + +Example output: +``` +You have removed an Expense + Type: Insurance + Amount: 800.00 + Description: ntuc income +from the Financial Planner. +Balance: -330.00 +``` +- Note: Balance displayed above is just an example. Your actual balance may differ. + +#### Delete recurring: `delete recurring` +Deletes a recurring cashflow from the Financial Planner. + +Format: `delete recurring INDEX [/r]` + +- `INDEX` refers to the index number shown in the displayed list when [`list recurring`](#list-recurring-list-recurring) command is used. +- `/r` is used to delete all **future** recurring cashflows **only**. + +Example of usage: `delete recurring 2 /r` + +Example output: +``` +You have removed future recurrences of this cashflow. +Updated cashflow: +Expense + Type: Insurance + Amount: 800.00 + Description: ntuc income +``` +Example of usage: `delete recurring 1` + +Example output: +``` +You have removed an Expense + Type: Necessities + Amount: 300.00 + Recurring every: 30 days, starting from: Oct 30 2023 + Description: groceries +from the Financial Planner. +Balance: -830.00 +- Note: Balance displayed above is just an example. Your actual balance may differ. + +``` +### List + +#### List all: `list` +// TODO + +Example output: + +``` +You have 4 matching cashflows: +1: Income + Type: Salary + Amount: 5000.00 + Recurring every: 30 days, starting from: Oct 30 2023 + Description: work +2: Expense + Type: Dining + Amount: 30.00 + Description: Genki Sushi +3: Expense + Type: Insurance + Amount: 800.00 + Recurring every: 365 days, starting from: Oct 30 2023 + Description: ntuc income +4: Expense + Type: Necessities + Amount: 300.00 + Recurring every: 30 days, starting from: Oct 30 2023 + Description: groceries +``` +#### List income: `list income` +//TODO + +Example output: +``` +You have 3 matching cashflows: +1: Income + Type: Salary + Amount: 5000.00 + Recurring every: 30 days, starting from: Oct 30 2023 + Description: work +2: Income + Type: Allowance + Amount: 500.00 + Recurring every: 30 days, starting from: Oct 30 2023 + Description: parents +3: Income + Type: Investments + Amount: 1000.00 +``` +#### List expense: `list expense` +//TODO + +Example output: +``` +You have 3 matching cashflows: +1: Expense + Type: Dining + Amount: 30.00 + Description: Genki Sushi +2: Expense + Type: Insurance + Amount: 800.00 + Recurring every: 365 days, starting from: Oct 30 2023 + Description: ntuc income +3: Expense + Type: Necessities + Amount: 300.00 + Recurring every: 30 days, starting from: Oct 30 2023 + Description: groceries +``` +#### List recurring: `list recurring` +Lists all recurring cashflows. + +Format: `list recurring` + +- This list will not include any cashflow that has already recurred. + +Example of usage: `list recurring` + +Example output: +``` +You have 2 matching cashflows: +1: Expense + Type: Insurance + Amount: 800.00 + Recurring every: 365 days, starting from: Oct 30 2023 + Description: ntuc income +2: Expense + Type: Necessities + Amount: 300.00 + Recurring every: 30 days, starting from: Oct 30 2023 + Description: groceries +``` ### Budget @@ -250,13 +559,37 @@ Existing data will be automatically loaded when the program starts up. {Give a 'cheat sheet' of commands here} -| Action | Format | -|----------------------|---------------------------| -| **Set budget** | `budget set /b BUDGET` | -| **Update budget** | `budget update /b BUDGET` | -| **Reset budget** | `budget reset` | -| **Delete budget** | `budget delete` | -| **View budget** | `budget view` | -| **Display Overview** | `overview` | -| **View balance** | `balance` | -| **Exit program** | `exit` | +| Action | Format | +|----------------------------------|-----------------------------------------------------------| +| **Add income** | `add income /a AMOUNT /t TYPE [/r DAYS] [/d DESCRIPTION]` | +| **Add expense** | `add expense /a AMOUNT /t TYPE [/r DAYS] [/d DESCRIPTION]` | +| **Delete cashflow** | `delete INDEX [/r]` | +| **Delete income** | `delete income INDEX [/r]` | +| **Delete expense** | `delete expense INDEX [/r]` | +| **Delete recurrence** | `delete recurrence INDEX [/r]` | +| **list all cashflows** | `list` | +| **list all incomes** | `list income` | +| **list all expenses** | `list expense` | +| **list all recurring cashflows** | `list recurrence` | +| **Set budget** | `budget set /b BUDGET` | +| **Update budget** | `budget update /b BUDGET` | +| **Reset budget** | `budget reset` | +| **Delete budget** | `budget delete` | +| **View budget** | `budget view` | +| **Display Overview** | `overview` | +| **View balance** | `balance` | +| **Exit program** | `exit` | + +- Note: Cashflow is referring to an income or expense + +**Income and Expense types** + +| Income | Expense | +|---------------|-----------------| +| `salary` | `dining` | +| `investments` | `entertainment` | +| `allowance` | `shopping` | +| `others` | `travel` | +| | `insurance` | +| | `necessities` | +| | `others` | diff --git a/src/main/java/seedu/financialplanner/FinancialPlanner.java b/src/main/java/seedu/financialplanner/FinancialPlanner.java index dba440ff5a..bdd75a6d00 100644 --- a/src/main/java/seedu/financialplanner/FinancialPlanner.java +++ b/src/main/java/seedu/financialplanner/FinancialPlanner.java @@ -33,7 +33,7 @@ public void run() { return; } - ui.welcomeMessage(date); + ui.welcomeMessage(); String input; Command command = null; diff --git a/src/main/java/seedu/financialplanner/cashflow/Cashflow.java b/src/main/java/seedu/financialplanner/cashflow/Cashflow.java index 739acf81a1..e4ba13f2f5 100644 --- a/src/main/java/seedu/financialplanner/cashflow/Cashflow.java +++ b/src/main/java/seedu/financialplanner/cashflow/Cashflow.java @@ -77,7 +77,8 @@ public String toString() { if (recur != 0) { string += System.lineSeparator() + " Recurring every: " + recur + " days"; - string += ", starting from: " + date.format(DateTimeFormatter.ofPattern("MMM dd yyyy")); + string += ", date added: " + date.format(DateTimeFormatter.ofPattern("MMM dd yyyy")); + string += ", recurring on: " + date.plusDays(recur).format(DateTimeFormatter.ofPattern("MMM dd yyyy")); } if (description != null) { string += System.lineSeparator() + " Description: " + description; diff --git a/src/main/java/seedu/financialplanner/commands/ListCommand.java b/src/main/java/seedu/financialplanner/commands/ListCommand.java index ca076fdb10..c7e8b1e062 100644 --- a/src/main/java/seedu/financialplanner/commands/ListCommand.java +++ b/src/main/java/seedu/financialplanner/commands/ListCommand.java @@ -60,11 +60,11 @@ public void execute() throws Exception { } if (cashflowToBePrinted.isEmpty()) { - ui.showMessage("No matching cashflow"); + ui.showMessage("No matching cashflow."); return; } - ui.showMessage(String.format("You have %d matching cashflow:", cashflowToBePrinted.size())); + ui.showMessage(String.format("You have %d matching cashflows:", cashflowToBePrinted.size())); for (int i = 0; i < cashflowToBePrinted.size(); i += 1) { ui.showMessage((i + 1) + ": " + cashflowToBePrinted.get(i)); } diff --git a/src/main/java/seedu/financialplanner/utils/Ui.java b/src/main/java/seedu/financialplanner/utils/Ui.java index 95fc57cc20..f3231e74de 100644 --- a/src/main/java/seedu/financialplanner/utils/Ui.java +++ b/src/main/java/seedu/financialplanner/utils/Ui.java @@ -6,8 +6,6 @@ import seedu.financialplanner.cashflow.Budget; import seedu.financialplanner.cashflow.Cashflow; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; import java.text.SimpleDateFormat; import java.util.Map; import java.util.Scanner; @@ -49,8 +47,7 @@ public void showMessage(String message) { System.out.println(message); } - public void welcomeMessage(LocalDate date) { - System.out.println("Current date: " + date.format(DateTimeFormatter.ofPattern("MMM dd yyyy"))); + public void welcomeMessage() { showMessage("Welcome to your Financial Planner. Type something to get started."); } diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT index fac51570d2..b95506d485 100644 --- a/text-ui-test/EXPECTED.TXT +++ b/text-ui-test/EXPECTED.TXT @@ -2,12 +2,10 @@ Directory doesn't exist. Creating directory... Watchlist file not found... Creating Initializing New watchlist.. adding AAPL and GOOGL for your reference File not found. Creating new file... -Current date: Oct 30 2023 Welcome to your Financial Planner. Type something to get started. You have added an Income Type: Salary Amount: 5000.00 - Recurring every: 30 days, starting from: Oct 30 2023 Description: part time job to the Financial Planner. Balance: 5000.00 @@ -19,7 +17,6 @@ Balance: 5123.12 You have added an Expense Type: Entertainment Amount: 100.00 - Recurring every: 30 days, starting from: Oct 30 2023 Description: netflix to the Financial Planner. Balance: 5023.12 @@ -36,7 +33,6 @@ Balance: 4776.79 You have removed an Income Type: Salary Amount: 5000.00 - Recurring every: 30 days, starting from: Oct 30 2023 Description: part time job from the Financial Planner. Balance: -223.21 @@ -48,7 +44,6 @@ Balance: -100.00 You have removed an Expense Type: Entertainment Amount: 100.00 - Recurring every: 30 days, starting from: Oct 30 2023 Description: netflix from the Financial Planner. Balance: 0.00 @@ -61,7 +56,6 @@ Use Watchlist to view it! You have added an Income Type: Salary Amount: 5000.00 - Recurring every: 30 days, starting from: Oct 30 2023 to the Financial Planner. Balance: 5000.00 A monthly budget of 3000.00 has been set. diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt index 9c5bae1bdc..60d9e76fe5 100644 --- a/text-ui-test/input.txt +++ b/text-ui-test/input.txt @@ -1,6 +1,6 @@ -add income /a 5000 /t salary /r 30 /d part time job +add income /a 5000 /t salary /d part time job add income /a 123.12 /t allowance -add expense /a 100 /t entertainment /r 30 /d netflix +add expense /a 100 /t entertainment /d netflix add expense /a 123.21 /t shopping delete income 2 delete 1 @@ -8,7 +8,7 @@ delete expense 2 delete 1 addstock /s MSFT addstock /s GME -add income /a 5000 /t salary /r 30 +add income /a 5000 /t salary budget set /b 3000 budget update /b 1000 add expense /a 200 /t shopping