Money Buddy is a personal financial tracker application that helps users effectively manage their income, expenses, and savings goals. The application provides a simple command-line interface for users to input and keep track of their financial transactions for a specific month and year, set and review savings goals, and analyze their financial performance through reports.
The intended user is anyone looking to manage their personal finances, track income and expenses, and set savings goals to better plan their financial future.
The project aims to address the challenge of effectively managing personal finances by providing users with an easy-to-use tool that consolidates financial information, allowing them to track income and expenses, set savings goals, and analyze their financial performance. Furthermore, if the user feels unsafe connecting their bank account to a third party app to use these tools, they can simply resort to Money Buddy
- Java Development Kit (JDK) to run an executable JAR file
- A serialized file ('financial_data.ser') for storing and loading user data.
- A CSV file export for generating financial reports.
- A command-line interface (CLI) for user interaction.
There are two ways you can start MoneyBuddy:
-
Make sure there is nothing in
bin
directory otherwise runmake clean
on the terminal -
Now, make sure you see the
executable jar
file in the project directory -
Now run
java -jar MoneyBuddy.jar
on the terminal, which will run the program
Now, how do you navigate through the Money Buddy Program itself?
- Lets see how you can report your income to Money Buddy
- Now, lets see how you can manage your expenses in Money Buddy
- You can also set Savings Goal for each year and month in Money Buddy!
-
Choose option 3, where you will have the option to set savings goal either as an amount or percentage for a specific year and month. For this use case analysis example, we'll choose to set savings goal as a percentage
-
After the Savings Goal is set, you can also view your savings goal for a specific year and month. We'll feed the command line two prompts in the following example.
3.1. Savings Goal for a month that wasn't set
3.2. Savings Goal for a month that was set
- After you have added all the required information you wanted to add as per your needs, you can check your financial summary for each specific year and month
- Enter option 4 in the main menu and then enter the year and month for the financial summary you would like to view For use case analysis, we'll look at two options the user can enter
4.1. No information added in financial summary
4.2. Information is in financial summary
- Lastly, you can export all this information in a
.csv
format to analyze all your financial reports. Enter 5 in main menu and enter name of the file(e.g. April&May.csv)
- If you are done using Money Buddy, enter 6 in the main menu. Don't worry, all your data will be saved!
Money Buddy deals with the following data:
- User data (User.java) : The user's financial data, including income and expenses.
- Income data (IncomeItem.java) : The income source, amount, and date.
- Expense data (ExpenseItem.java) : The expense category, description, amount, and date.
- Savings Goal data (SavingsGoal.java) : The goal amount, and if it is percentage-based, the percentage of income, and the year and month.
Money Buddy also uses serialization to save and load the user data in a file (financial_data.ser)
. This makes sure that the data is persistent
The User class manages the income, expenses, and savings goals. It provides methods for adding income and expenses, calculating totals, and managing savings goals. This shows that the data is aggregated into a larger structure within the User
class.
Below is the UML Diagram for Money Buddy, which shows how data is represented and the basic data structure of how data may be related:
Money Buddy has no UI for the time being and utilizes the Command Line Interface
Below is the basic Algorithm:
- Add income
- Add expense
- Set savings goal
- View financial summary
- Export data
- Exit program
To create a more visually pleasing CLI, use text formatting, ASCII Art, and clear navigation prompts.
- Prompt the user to enter income details (source, amount, date)
- Validate and store the income data.
- Update the financial summary
- Prompt the user to enter expense details (category, amount, date)
- Validate and store the expense data
- Update the financial summary
- Prompt the user to enter a monthly savings goal option: Fixed amount or percentage of income
- If the user chooses a fixed amount, the user enters a monthly savings goal in dollars
- If the user chooses a percentage of income, the user enters a percentage which is validated. The savings goal in dollars is then calculated based on the entered percentage and total income
- Store the savings goal
- Update the financial summary
- Retrieve the user's financial data:
- Access the stored data related to the user's income, expenses, and savings goal.
- Calculate the financial summary:
- Total income: Sum all income sources to obtain the total income.
- Total expenses: Sum all expenses (by category or overall) to obtain the total expenses.
- Savings progress: Calculate the savings progress by subtracting the total expenses from the total income. Then compare the savings progress with the user's savings goal to determine if the goal has been met, exceeded, or not reached.
- Format the financial summary and display it
- Prompt the user to select a file format:
- Display a list of supported file formats (e.g., CSV, PDF, etc.) and ask the user to choose one.
- Display an error message if user inputs wrong choice
- Generate the financial report:
- Retrieve the user's financial data (income, expenses, savings goal, etc.) and organize it into a structured format that can be easily converted to the chosen file format.
- Depending on the selected format, apply the appropriate formatting rules and convert the structured data into the desired file format. For example creating a CSV file with comma-separated values or a PDF document with formatted text and tables, or any other format-specific conversion.
- Export the data
- Prompt the user to specify a file name and location to save the exported file, and save the file in that location
- Display a confirmation message if data exported successfully
Below is the in-depth basic Algorithm for each class:
- Data Members:
monthlyIncomeItems:
a HashMap that storesYearMonth
as the key and a list ofIncomeItem
objects as the value.monthlyExpenseItems:
a HashMap that storesYearMonth
as the key and a list ofExpenseItem
objects as the value.incomeItems:
a List of IncomeItem objects.expenseItems:
a List of ExpenseItem objects.savingsGoals:
a HashMap that stores YearMonth as the key and a SavingsGoal object as the value.
- Initializer (constructor):
- Initialize all data members with empty data structures (e.g., empty ArrayLists or HashMaps).
- Define access methods for all data members (getters and setters):
getIncomeItems
andsetIncomeItems
forincomeItems
getExpenseItems
andsetExpenseItems
forexpenseItems
getSavingsGoal
andsetSavingsGoal
forsavingsGoals
getMonthlyIncomeItems
formonthlyIncomeItems
getMonthlyExpenseItems
formonthlyExpenseItems
- All other additional methods:
addIncome
method for adding an IncomeItem object to themonthlyIncomeItems
HashMap and updating the savings goal if necessaryaddExpense
method for adding an ExpenseItem object to themonthlyExpenseItems
HashMapcalculateTotalIncome
method for calculating the total income for a specific year and monthcalculateTotalExpenses
method for calculating the total expenses for a specific year and monthcalculateTotalSavings
method for calculating the total savings for a specific year and monthupdateSavingsGoal
method for updating the savings goal based on the provided parametersupdateSavingsGoalBasedOnPercentage
method for updating the savings goal based on the original percentage for a specific year and monthsave
method for saving a User object to a fileload
method for loading a User object from a file
- Data Members:
source
: a String representing the source of the income.amount
: a double representing the amount of income.date
: a LocalDate representing the date of the income.
- Initializer (constructor)
- Accept three parameters:
source, amount, and date.
- Assign the values of the parameters to the data members.
- Define access methods for all data members (getters and setters):
getSource
andsetSource
forsource
getAmount
andsetAmount
foramount
getDate
andsetDate
fordate
- Data Members:
category
: a String representing the category of the expense.description
: a String representing the description of the expense.amount
: a double representing the amount of the expense.date
: a LocalDate representing the date of the expense.
- Initiializer (Constructor):
- Accept four parameters:
category, description, amount, and date.
- Assign the values of the parameters to the corresponding data members.
- Define access methods for all data members (getters and setters):
getCategory
andsetCategory
forcategory
getDescription
andsetDescription
fordescription
getAmount
andsetAmount
foramount
getDate
andsetDate
fordate
- Data Members:
goal
: a double representing the savings goal amount.goalAmount
: a double representing the current goal amount.percentage:
a double representing the percentage of the savings goal.percentageBased:
a boolean indicating whether the goal is percentage-based.goalPercentage:
a double representing the goal percentage.originalPercentage:
a double representing the original percentage value.yearMonth:
a YearMonth object representing the year and month of the savings goal.
- Initializers (Constructors):
- Default constructor which sets
goal
to 0,percentageBased
to false,percentage
to 0 - Constructor with
goal
parameter, setsgoal
to given value,percentage
to 0 andpercentageBased
to false.
Constructor with goal
, percentageBased
, percentage
, and yearMonth
parameters:
- Set
goal
to the given value. - Set
percentageBased
to the given value. - Set
percentage
andoriginalPercentage
to the given value. - Set
yearMonth
to the given value. - Set
goalAmount
to the given value.
- Define access methods for all data members (getters and setters):
getGoal
,setGoal
forgoal
getGoalAmount
,setGoalAmount
forgoalAmount
getPercentage
,setPercentage
forpercentage
isPercentageBased
forpercentageBased
getGoalPercentage
,setGoalPercentage
forgoalPercentage
getOriginalPercentage
,setOriginalPercentage
fororiginalPercentage
getYearMonth
foryearMonth
- Data Members
filename
: a String representing the name of the file where user data is saved
- Initializers (Constructors)
- Accept a
filename
parameter and set the filename data member to the given value.
saveUserData
method:
- Accept a
User
object as a parameter. - Create a
FileOutputStream
object with thefilename
data member. - Create an
ObjectOutputStream
object using theFileOutputStream
. - Write the
User
object to theObjectOutputStream
. - Close the
ObjectOutputStream
. - Catch and handle any
IOException
that may occur.
loadUserData
method:
- initialize a
User
object, user, tonull.
- Create a
FileInputStream
object with thefilename
data member. - Create an
ObjectInputStream
object using theFileInputStream.
- Read a
User
object from theObjectInputStream
and assign it to user. - Close the
ObjectInputStream.
- Catch and handle any
IOException
orClassNotFoundException
that may occur. - Return the
User object.
- Data Members
DATA_FILE
: a constant String representing the file name for saving user data.user
: a User object to manage income, expenses, and savings goals.scanner
: a Scanner object for reading input from the command line.df:
a DecimalFormat object for formatting currency values.
- Initializer (Constructor)
- Initialize the User, Scanner, and DecimalFormat objects.
- Load the user data from the
DATA_FILE.
start
method:
- prints a welcome message and calls the
mainMenu
method
mainMenu
method:
- Display main menu in a loop, read the user's choice, and based on the user choice call the appropriate method.
main
method creates a newCLI
object and calls thestart
method on the created objectmanageIncome
adds income items to the usermanageExpenses
adds expense items to the usersetSavingsGoal
manages the user's savings goals (amount or percentage based)viewFinancialSummary
displays the user's financial summary for a given year and monthexportData
exports the user's data to a CSV file.setSavingsGoalAmount
sets an amount based savings goal (not percentage based)viewSavingsGoalAmount
displays the user's savings goal for a specific year and month.
- Data Members:
User
object nameduser
to manage income, expenses and savings goals.- A
DecimalFormat
object nameddf
for formatting currency values
generateCSVReport
method takes a file name as a parameter and returns a boolean value. It also create a newFile, FileWriter, and PrintWriter
objects. Furthermore, it writes the headers and data for the Income Items, Expenses, Savings Goals sections. Lastly, it returns true if the report was generated successfully, and false otherwise. Also closes thePrintWriter
andFileWriter
objects
In the future, additional features and enhancements could be considered:
- Implement Mult-user support and also enhancing data security measures to protect user financial information, such as implementing encryption, password protection, and more measures.
- Graphical User Interface (GUI) to improve user experience
- Using a database to store and manage user data more efficiently.
- Add customizable budget categories and subcategories to help users better organize their expenses and monitor their spending habits.
- Implement a feature to send users alerts or notifications when they are nearing their budget limits or when they have achieved their savings goals.
- Implementing real time multiple currencies and currency conversion by using some sort of API
- Introduce the ability to manage recurring income and expenses, such as monthly bills or salaries, to automate the tracking process and reduce manual data entry.
- Incorporate data visualization features, such as graphs and charts, to help users better understand their financial trends and make informed decisions.