Mini Project Documentation
Mini Project Documentation
PAGE NO:
DATE:
1. Introduction
The Roommate Expense Sharing Application is designed to simplify expense
tracking and sharing among roommates. Built using JavaFX, it provides an intuitive graphical
interface to manage shared costs effectively. Users can add roommates, record expenses, set a
manual total for group expenses, log payments, and calculate balances. The application also
generates summaries showing how much each person owes or is owed, ensuring transparency
in cost-sharing.
2. System Requirements
2.1 Hardware Requirements
RAM: Minimum 4GB
Processor: Intel Core i3 or equivalent
Operating System: Windows, macOS, or Linux
2.2 Software Requirements
Java Development Kit (JDK): Version 8 or higher
JavaFX SDK: Included in most modern JDKs
Integrated Development Environment (IDE): IntelliJ IDEA, Eclipse, or NetBeans
The above requirements ensure smooth operation of the application without performance
issues.
3. Application Features
3.1 Adding Roommates
Users can add roommates by entering their names and clicking the "Add Person" button. The
application prevents duplicate entries, ensuring that each roommate has a unique identifier.
3.2 Recording Transactions
Expenses can be recorded by specifying the amount and selecting the person who paid. The
system stores these transactions and displays them in the transaction list.
3.3 Manual Total Expenses
Users can set a manual total expense value if the total is known beforehand. This overrides
the dynamically calculated total.
3.4 Payment Recording
Payments made by individuals can be logged, which reduces their balances. The payment
system helps track how much each person has contributed toward settling their share.
3.5 Calculating Balances
The "Calculate Share" button computes balances for all roommates based on expenses and
payments. It displays:
Total group expenses
Individual contributions
Balances owed or owed to each person
5. Application Architecture
5.1 Main Class
The main class initializes the user interface and processes user inputs. It handles the
following:
Adding and managing roommates
Recording expenses and payments
Calculating and displaying summaries
5.2 Person Class
The Person class represents a roommate and includes:
Name of the roommate
List of transactions
Payments made
Methods to calculate total expenses and balances
5.3 Transaction Class
The Transaction class represents an expense and includes:
Amount of the expense
Person who paid for the expense
5.4 Data Flow
User inputs are processed in the ExpenseSharingAppFX class.
Data is stored and manipulated using the Person and Transaction classes.
Outputs, such as summaries and lists, are updated dynamically.
6. Workflow
6.1 Adding a Roommate
1. Enter the name in the "Enter person's name" field.
2. Click the "Add Person" button.
3. The roommate is added to the list and becomes selectable in the dropdowns.
6.2 Recording an Expense
1. Enter the expense amount in the field.
2. Select the payer from the dropdown menu.
3. Click the "Add Transaction" button to save the expense.
6.3 Setting a Manual Total
1. Enter the total expense value in the provided field.
2. Click the "Set Total Expense" button.
3. The manual total is applied, overriding the dynamic calculation.
6.4 Recording a Payment
1. Enter the payment amount in the text field.
2. Select the payer from the dropdown.
3. Click the "Record Payment" button to save the payment.
6.5 Calculating Balances
1. Click the "Calculate Share" button.
2. View the detailed breakdown in the summary area.
7. Error Handling
7.1 Input Validation
Ensures that text fields are not empty and values are correctly formatted.
Checks for duplicate names when adding roommates.
7.2 Alerts
Error alerts notify users of invalid inputs or missing data.
Success alerts confirm actions like adding a person or recording a payment.
7.3 Robustness
The application handles edge cases, such as:
No roommates added
Zero expenses recorded
Negative or invalid amounts
8. Future Enhancements
While the Roommate Expense Sharing Application is fully functional, there are several ways
it can be improved to offer more features and better user experience:
package com.example.expensetracker;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import java.util.ArrayList;
@Override
public void start(Stage primaryStage) {
persons = new ArrayList<>();
primaryStage.setTitle("Roommate Expense Sharing System");
mainLayout.setTop(topPanel);
mainLayout.setCenter(middlePanel);
mainLayout.setBottom(calculatePanel);
double totalExpenses = 0;
if (manualTotalExpenses >= 0) {
totalExpenses = manualTotalExpenses;
} else {
for (Person person : persons) {
totalExpenses += person.getTotalExpenses();
}
}
summary.append("Individual Contributions:\n");
for (Person person : persons) {
double totalPaid = person.getTotalExpenses();
summary.append(person.getName() + " paid: $" + String.format("%.2f", totalPaid) +
"\n");
}
summary.append("\nBalances:\n");
for (Person person : persons) {
double balance = person.getBalance(equalShare);
if (balance > 0) {
summary.append(person.getName() + " is owed: $" + String.format("%.2f",
balance) + "\n");
} else if (balance < 0) {
summary.append(person.getName() + " owes: $" + String.format("%.2f", -balance)
+ "\n");
} else {
summary.append(person.getName() + " is settled.\n");
}
}
summaryArea.setText(summary.toString());
}
Conclusion:
The Roommate Expense Sharing Application provides a practical solution for tracking
and managing shared expenses. It is intuitive, lightweight, and highly functional, making it an
excellent choice for roommates who want a fair and transparent way to divide costs. With
potential enhancements, the application can evolve into a more robust and versatile tool for
personal finance management.