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
bindirectory otherwise runmake cleanon the terminal

-
Now, make sure you see the
executable jarfile in the project directory
-
Now run
java -jar MoneyBuddy.jaron 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
.csvformat 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 storesYearMonthas the key and a list ofIncomeItemobjects as the value.monthlyExpenseItems:a HashMap that storesYearMonthas the key and a list ofExpenseItemobjects 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):
getIncomeItemsandsetIncomeItemsforincomeItemsgetExpenseItemsandsetExpenseItemsforexpenseItemsgetSavingsGoalandsetSavingsGoalforsavingsGoalsgetMonthlyIncomeItemsformonthlyIncomeItemsgetMonthlyExpenseItemsformonthlyExpenseItems
- All other additional methods:
addIncomemethod for adding an IncomeItem object to themonthlyIncomeItemsHashMap and updating the savings goal if necessaryaddExpensemethod for adding an ExpenseItem object to themonthlyExpenseItemsHashMapcalculateTotalIncomemethod for calculating the total income for a specific year and monthcalculateTotalExpensesmethod for calculating the total expenses for a specific year and monthcalculateTotalSavingsmethod for calculating the total savings for a specific year and monthupdateSavingsGoalmethod for updating the savings goal based on the provided parametersupdateSavingsGoalBasedOnPercentagemethod for updating the savings goal based on the original percentage for a specific year and monthsavemethod for saving a User object to a fileloadmethod 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):
getSourceandsetSourceforsourcegetAmountandsetAmountforamountgetDateandsetDatefordate
- 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):
getCategoryandsetCategoryforcategorygetDescriptionandsetDescriptionfordescriptiongetAmountandsetAmountforamountgetDateandsetDatefordate
- 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
goalto 0,percentageBasedto false,percentageto 0 - Constructor with
goalparameter, setsgoalto given value,percentageto 0 andpercentageBasedto false.
Constructor with goal, percentageBased, percentage, and yearMonth parameters:
- Set
goalto the given value. - Set
percentageBasedto the given value. - Set
percentageandoriginalPercentageto the given value. - Set
yearMonthto the given value. - Set
goalAmountto the given value.
- Define access methods for all data members (getters and setters):
getGoal,setGoalforgoalgetGoalAmount,setGoalAmountforgoalAmountgetPercentage,setPercentageforpercentageisPercentageBasedforpercentageBasedgetGoalPercentage,setGoalPercentageforgoalPercentagegetOriginalPercentage,setOriginalPercentagefororiginalPercentagegetYearMonthforyearMonth
- Data Members
filename: a String representing the name of the file where user data is saved
- Initializers (Constructors)
- Accept a
filenameparameter and set the filename data member to the given value.
saveUserDatamethod:
- Accept a
Userobject as a parameter. - Create a
FileOutputStreamobject with thefilenamedata member. - Create an
ObjectOutputStreamobject using theFileOutputStream. - Write the
Userobject to theObjectOutputStream. - Close the
ObjectOutputStream. - Catch and handle any
IOExceptionthat may occur.
loadUserDatamethod:
- initialize a
Userobject, user, tonull. - Create a
FileInputStreamobject with thefilenamedata member. - Create an
ObjectInputStreamobject using theFileInputStream. - Read a
Userobject from theObjectInputStreamand assign it to user. - Close the
ObjectInputStream. - Catch and handle any
IOExceptionorClassNotFoundExceptionthat 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.
startmethod:
- prints a welcome message and calls the
mainMenumethod
mainMenumethod:
- Display main menu in a loop, read the user's choice, and based on the user choice call the appropriate method.
mainmethod creates a newCLIobject and calls thestartmethod on the created objectmanageIncomeadds income items to the usermanageExpensesadds expense items to the usersetSavingsGoalmanages the user's savings goals (amount or percentage based)viewFinancialSummarydisplays the user's financial summary for a given year and monthexportDataexports the user's data to a CSV file.setSavingsGoalAmountsets an amount based savings goal (not percentage based)viewSavingsGoalAmountdisplays the user's savings goal for a specific year and month.
- Data Members:
Userobject nameduserto manage income, expenses and savings goals.- A
DecimalFormatobject nameddffor formatting currency values
generateCSVReportmethod takes a file name as a parameter and returns a boolean value. It also create a newFile, FileWriter, and PrintWriterobjects. 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 thePrintWriterandFileWriterobjects
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.






