Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javadoc ndg #197

Merged
merged 7 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 52 additions & 6 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,29 +338,75 @@ Example: `budget view`
## Product scope
### Target user profile

{Describe the target user profile}
Our target user profile is ...
- a working adult with a source of income
- someone who dislike navigating graphic user interface
- someone who can type fast
- someone who cannot manage their finances such as income and expenses properly
- unable to reach their financial goals
- is slightly interested in the equity market
- needs reminders for tasks


### Value proposition

{Describe the value proposition: what problem does it solve?}
Our financial planner application can help individuals manage their finances effectively and achieve their financial
goals. The purpose of such an application is to provide users with a range of tools and features to help them better
understand their financial situation. This will enable them to make more informed decisions, and plan for their future
financial well-being. The application will allow the user to keep track of their income, expenses and overall balance.
It also lets user view their income and expenses using visualization tool to have a better view of their cash flow based
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets the user*

on categories. It also allows the user to set the budget for the month. It also allows users to add their financial
goals to the wishlist. Furthermore, it allows users to track the stock market if they have interest in investing in
equities.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good details


## User Stories

|Version| As a ... | I want to ... | So that I can ...|
|--------|----------|---------------|------------------|
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application|
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list|
| Version | As a ... | I want to ... | So that I can ... |
|---------|-----------------------|-------------------------------|--------------------------------------------------------------------------------------|
| v1.0 | user | Add my income | Store my income information and view/track them later |
| v1.0 | user | Delete my income | Remove the income entry that I have mistakenly added or do not keep track |
| v1.0 | user | Add my expense | Store my expense information and view/track them later |
| v1.0 | user | Delete my expense | Remove the expense entry that I have mistakenly added or do not keep track |
| v2.0 | user | set my expense type | Break down my expenses into different categories |
| v1.0 | user | set my income type | Break down my income into different categories |
| v2.0 | user | Add recurring cash flows | add a regular expense or income (salary, rent) easily |
| v2.0 | user | Delete recurring cash flows | delete a regular expense of income easily |
| v1.0 | user | list all cash flow entries | view all my income and expenses in a comprehensive list |
| v1.0 | user | list all expenses entries | view all my expenses in a comprehensive list |
| v1.0 | user | list all income entries | view all my income in a comprehensive list |
| v2.0 | user | list all recurring cash flows | view all my recurring income or expenses in a comprehensive list |
| v2.0 | new user | see usage instructions | refer to them when I forget how to use the application |
| v1.0 | user | set a budget | keep track of a budget together with my cash flow and ensure I do not exceed it |
| v1.0 | user | update the budget | make changes to the budget according to my needs |
| v1.0 | user | reset the budget | return to my initial budget easily |
| v1.0 | user | delete budget | remove the budget that I no longer want to keep track of |
| v1.0 | user | view budget | keep track of the amount of budget I have left |
| v1.0 | user | see overview of the app | see the overall view of all income, expense and overall balance as well as reminders |
| v1.0 | user | view balance | see my overall balance according to the income and expenses I am keeping track |
| v1.0 | investment enthusiast | view my watchlist | keep track of stocks that I am interested in |
| v2.0 | investment enthusiast | add new stocks to watchlist | add new stock that I am interested in investing in |
| v2.0 | investment enthusiast | delete stocks from watchlist | remove stocks that I am no longer interested in |
| v1.0 | user | add reminder | add reminders (eg to pay loans) so I will not forget |
| v1.0 | user | delete reminder | delete reminders that I no longer want to keep track |
| v1.0 | user | mark reminder | set the reminder as completed |
| v1.0 | user | view wishlist | keep track of my goals easily |
| v1.0 | user | set goals | add a new goal to my that I think of |
| v1.0 | user | delete goals | remove goals that I can no longer achieve |
| v1.0 | user | mark goal | that I have achieved |
| v1.0 | user | visualize my cash flow | easily see where the distribution for my spending and earnings |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice hard work


## Non-Functional Requirements

* Should work on main OS (Windows, Linux, Mac) that has Java 11 installed.
* This app is meant for a single user.
* This app is targeted towards users with an above-average typing speed.
* Watchlist should work reliably and not crash the application when the 3rd party dependencies are down (API is down)

## Glossary

* *Cashflow* - Refers to an income or expense.
* *WishList* - A list containing goals/targets.
* *Watchlist* - a list of stocks that the financial planner is currently tracking
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalise "a"


## Instructions for manual testing

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to add this too?

Expand Down
13 changes: 13 additions & 0 deletions src/main/java/seedu/financialplanner/commands/AddStockCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Command that inherits from the Command abstract class
* Represents that command that add stock to watchlist
*/
public class AddStockCommand extends Command {
private static final Logger logger = Logger.getLogger("Financial Planner Logger");
private final String stockCode;

/**
* Constructor for the command add stock to watchlist
*
* @param rawCommand
* @throws IllegalArgumentException
*/
public AddStockCommand(RawCommand rawCommand) throws IllegalArgumentException {
if (!rawCommand.extraArgs.containsKey("s")) {
throw new IllegalArgumentException("Stock code cannot be empty");
Expand All @@ -28,6 +38,9 @@ public AddStockCommand(RawCommand rawCommand) throws IllegalArgumentException {
}
}

/**
* Executes the command to add stock to watchlist
*/
@Override
public void execute() {
Ui ui = Ui.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Command that inherits from the Command abstract class
* Represents the command to delete stock from watchlist
*/
public class DeleteStockCommand extends Command {
private static final Logger logger = Logger.getLogger("Financial Planner Logger");
private final String stockCode;

/**
* Constructor for the command to delete stock from watchlist
*
* @param rawCommand
* @throws IllegalArgumentException
*/
public DeleteStockCommand(RawCommand rawCommand) throws IllegalArgumentException {
if (!rawCommand.extraArgs.containsKey("s")) {
throw new IllegalArgumentException("Stock code cannot be empty");
Expand All @@ -28,6 +38,11 @@ public DeleteStockCommand(RawCommand rawCommand) throws IllegalArgumentException
}
}

/**
* Executes the command to delete stock from watchlist
*
* @throws Exception
*/
@Override
public void execute() throws Exception {
Ui ui = Ui.getInstance();
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/seedu/financialplanner/commands/VisCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Command class that inherit from Command abstract class
* Represents the command to visualize your cash flow
*/
public class VisCommand extends Command {
private static final Logger logger = Logger.getLogger("Financial Planner Logger");
private String type;
private String chart;

/**
* Constructor for the command to visualize cash flow
*
* @param rawCommand
* @throws IllegalArgumentException
*/
public VisCommand(RawCommand rawCommand) throws IllegalArgumentException {
if (!rawCommand.extraArgs.containsKey("t")) {
throw new IllegalArgumentException("Entry type must be defined");
Expand All @@ -35,6 +45,11 @@ public VisCommand(RawCommand rawCommand) throws IllegalArgumentException {
}
}

/**
* Executes the command to visualize cash flow
*
* @throws FinancialPlannerException
*/
@Override
public void execute() throws FinancialPlannerException {
Ui ui = Ui.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Command that inherits from Command abstract class
* Represents the command to fetch and display watchlist data
*/
public class WatchListCommand extends Command {
private static final Logger logger = Logger.getLogger("Financial Planner Logger");

/**
* Constructor for the command to fetch and display watchlist data
*
* @param rawCommand
* @throws IllegalArgumentException
*/
public WatchListCommand(RawCommand rawCommand) throws IllegalArgumentException{
if (!rawCommand.extraArgs.isEmpty()) {
logger.log(Level.WARNING, "Invalid extra arguments found");
Expand All @@ -20,6 +30,9 @@ public WatchListCommand(RawCommand rawCommand) throws IllegalArgumentException{
}
}

/**
* Executes the command to fetch and display watchlist data
*/
@Override
public void execute() {
Ui ui = Ui.getInstance();
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/seedu/financialplanner/investments/Stock.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Represents a stock within the financial planner app
*/
public class Stock {
private static final Logger logger = Logger.getLogger("Financial Planner Logger");
private static final String API_ENDPOINT = "https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=";
Expand All @@ -30,11 +33,24 @@ public class Stock {
private Date lastUpdated = null;
private long lastFetched = 0;

/**
* Constructor for stock that sets the symbol and searches the api
* for stock name for it
*
* @param symbol
* @throws FinancialPlannerException
*/
public Stock(String symbol) throws FinancialPlannerException {
this.symbol = symbol;
this.stockName = getStockNameFromAPI(symbol);
}

/**
* Constructor that sets the symbol and stock name directly
*
* @param symbol
* @param stockName
*/
public Stock(String symbol, String stockName) {
this.symbol = symbol;
this.stockName = stockName;
Expand All @@ -44,6 +60,14 @@ public String getStockName() {
return stockName;
}

/**
* Method that gets the stock name from the Alpha vantage api. Will throw financial planner exception for any errors
* when attempting this. If succuessful, will return the stock name for the symbol provided
*
* @param symbol
* @return stock name
* @throws FinancialPlannerException
*/
public String getStockNameFromAPI(String symbol) throws FinancialPlannerException {
String requestURI = String.format("%s%s&apikey=%s", API_ENDPOINT,symbol,API_KEY);
HttpClient client = HttpClient.newHttpClient();
Expand Down Expand Up @@ -102,6 +126,11 @@ public void setSymbol(String symbol) {
this.symbol = symbol;
}

/**
* toString method is override to output its symbol appended with a comma
*
* @return
*/
@Override
public String toString() {
return symbol + ",";
Expand Down
Loading
Loading