You are on page 1of 80

Synopsis for the Project: Expense Tracker

Title of the Project:


"Expense Tracker: Streamlining Personal Finance Management"
Introduction and Statement about the Problem:
Effective management of personal finances is a common challenge in the digital
age. Individuals often struggle to maintain a clear and organized record of their
expenses, leading to inefficient budgeting and financial mismanagement. The
absence of a straightforward and comprehensive tool for tracking personal
expenses contributes to these challenges, highlighting the need for a digital
solution that simplifies and centralizes personal finance management.
Why Was This Particular Topic Chosen?
Recognizing the importance of financial literacy and efficient expense
management, "Expense Tracker" was chosen to fill the gap in the market for an
easy-to-use, all-encompassing personal finance tool. The project is geared
towards individuals seeking a digital assistant to help them track expenditures,
manage budgets, and gain insights into their spending patterns.
Objective and Scope of the Project:
Objective: To develop "Expense Tracker," a user-friendly application designed
to aid individuals in monitoring and managing their personal expenses and
budgets efficiently.
Scope:
• "Expense Tracker" will enable users to log and categorize their expenses,
set budget limits, and view historical spending data.
• The application will feature capabilities such as expense categorization,
budget alerts, customizable reports, and visual analytics of spending
trends.
• Targeted at individual users, the application aims to simplify personal
finance management across various income levels and lifestyles.
Methodology:
• Development Methodology: Employing an Agile development
framework to ensure a flexible, iterative, and user-focused development
process.

1
• System Design: Creating a scalable and intuitive system architecture that
supports various functionalities like real-time expense logging, data
visualization, and report generation.

Hardware & Software Requirements:


• Hardware: Standard personal computing devices for development and
testing.
• Software:
• Frontend Development: JavaFX for crafting a responsive and
engaging user interface.
• Backend Development: Java, leveraging its robust libraries and
frameworks for backend logic.
• Database Management: JDBC for database connectivity and
SQLite for a lightweight, file-based database system.
• Version Control: Git for source code management.
• Testing Tools: JUnit for unit testing and other relevant tools for
functional and performance testing.
Testing Technologies and Methodologies:
• Comprehensive testing approach including unit, integration, and system
testing to ensure functional integrity and performance efficacy.
• User Acceptance Testing (UAT) to validate the application against user
requirements and expectations.
• Continuous testing throughout the development cycle to maintain high
standards of quality and reliability.
Contribution of the Project:
"Expense Tracker" aims to make a significant impact in the realm of personal
finance management by:
• Offering a consolidated platform for tracking and analysing personal
expenses.
• Empowering users with data-driven insights for better financial decision-
making.
• Simplifying the budgeting process and enhancing financial discipline
among users.
2
• Providing a customizable and intuitive tool adaptable to various user
preferences and financial objectives.
Conclusion:
"Expense Tracker" stands as a testament to the transformative potential of
digital solutions in everyday life. It is not merely a tool for financial
management but a step towards fostering a more financially aware and
disciplined society. By integrating critical financial management functionalities
into a single platform, "Expense Tracker" is set to redefine personal finance
management for its users.

3
2. Theoretical Background and Definition of the Problem

Theoretical Background
1. Principles of Personal Finance Management: Central to Expense
Tracker's theoretical foundation is the concept of efficient personal
finance management. This includes budgeting, tracking expenses, and
financial planning. The application draws from financial theories that
stress the importance of being aware of one’s financial habits as a step
towards achieving financial stability and independence.
2. User Experience in Financial Applications: Emphasizing a user-centric
approach, the design principles of Expense Tracker are rooted in creating
an intuitive and accessible interface. This aligns with theories in software
design that prioritize ease of use, especially for applications dealing with
complex data like personal finances.
3. Behavioural Economics in Spending: The application incorporates
concepts from behavioural economics to help users understand and
potentially alter their spending habits. By providing insights and
visualizations of their financial activities, users are encouraged to make
more informed and reflective spending choices.
4. Data Analytics in Personal Budgeting: The application leverages data
analytics to provide users with a detailed breakdown of their spending.
This approach is based on the idea that data-driven insights can lead to
better financial decisions and more effective budget management.
5. Technology Integration in Daily Life: Recognizing the increasing role
of technology in daily life, Expense Tracker integrates seamlessly into the
user's routine, making the task of managing personal finances more
convenient and less time-consuming.
Definition of the Problem
Expense Tracker addresses several key problems in the realm of personal
finance management:
1. Inefficient Tracking and Management: Many individuals struggle with
keeping a detailed and organized record of their expenses, leading to a
lack of clarity in their financial status.
2. Overwhelming Financial Data: Without a system to categorize and
simplify financial data, users can become overwhelmed, hindering
effective budget management and financial planning.

4
3. Limited Financial Insights: Traditional methods of tracking expenses
often do not provide meaningful insights into spending habits, making it
challenging for users to identify areas where they can optimize their
spending.
4. Inaccessibility to Simplified Financial Management Tools: There is a
need for a simple yet comprehensive tool that can cater to a wide range of
users, from those who are financially savvy to those who are just
beginning to manage their personal finances.
5. Lack of Integration in Daily Life: Many existing financial tools do not
integrate well into the daily lives of users, requiring them to go out of
their routine to manage their finances.
Expense Tracker aims to solve these problems by providing an easy-to-use,
integrated, and insightful tool for managing personal finances, encouraging
better financial habits and informed decision-making.

5
3. System Analysis & Design vis-à-vis User Requirements

System Analysis
The system analysis phase for Expense Tracker was a comprehensive process
that involved evaluating the existing personal finance management systems and
identifying areas for enhancement. The analysis focused on aligning the
application with the needs of potential users and current market trends.
1. Requirement Gathering:
• Conducted in-depth research to gather requirements from potential
users, particularly individuals looking for a straightforward way to
manage their personal finances. This included conducting surveys,
interviews, and interactive sessions with people who regularly
track their expenses.
• Key areas of focus were ease of data entry, intuitive categorization
of expenses, budgeting features, and the ability to generate
insightful reports.
2. Market Research:
• Performed a thorough analysis of the current market to identify
existing solutions in personal finance management and their
limitations. This helped in understanding what features are most
valued by users and where other applications may be falling short.
• Examined emerging trends, such as mobile integration, cloud-
based data storage, and AI-driven financial insights, to ensure that
Expense Tracker remains competitive and relevant.
3. Process Mapping:
• Mapped out the typical process an individual undergoes when
managing personal finances, from recording transactions to
analysing spending patterns.
• Identified inefficiencies and common pain points in current
practices, such as the difficulty in maintaining consistent expense
records and challenges in deriving actionable insights from raw
financial data.
4. User Persona Creation:
• Developed user personas representing the target audience for
Expense Tracker. These personas encompassed a variety of

6
demographics, financial literacy levels, and personal budgeting
goals.
• Each persona highlighted specific needs and challenges, guiding
the design and functionality of the Expense Tracker to ensure it
addresses real user requirements.
5. Use Case Development:
• Developed detailed use cases to outline how potential users would
interact with Expense Tracker. These use cases spanned a range of
functionalities, including initial setup, daily expense logging,
budget creation and monitoring, report generation, and long-term
financial planning.
• Use cases were instrumental in defining the necessary features and
guiding the development process to ensure the final product aligns
with user expectations and solves real-world problems in personal
finance management.
Through this systematic analysis, Expense Tracker was conceptualized to not
only meet but exceed the expectations of individuals seeking an effective and
user-friendly tool for managing their personal finances. The insights gained
from this phase played a pivotal role in shaping the development strategy and
ensuring that the application addresses the core needs of its users.

System Design for Expense Tracker


The design phase for Expense Tracker was critical in transforming the insights
gained from the system analysis into a practical blueprint. This phase involved
developing a detailed design that met the identified needs and requirements.
1. Architecture Design:
• The application's architecture was planned to be robust and
scalable. A modular architecture was chosen, ensuring that different
components of the application, such as expense tracking,
budgeting, and reporting, could be easily maintained and updated
independently.
2. User Interface (UI) Design:
• The UI was crafted with a strong emphasis on simplicity and
intuitiveness. The layout, color scheme, and typography were
selected to optimize user experience and visual appeal. A key focus

7
was on minimizing user input effort and maximizing clarity and
accessibility of financial information.
3. Database Design:
• A comprehensive database schema was developed to store and
manage user data effectively. The design included tables for
tracking expenses, categorizing them, storing user profiles, and
managing budget information. Care was taken to ensure data
integrity, normalization, and security.
4. Feature Specification:
• Each feature of Expense Tracker was meticulously specified. This
included the functionality of the expense logging mechanism,
budget setting and monitoring tools, reporting modules, and data
visualization aspects.
5. Workflow Design:
• Workflows for key processes such as recording expenses, creating
and adjusting budgets, and generating financial reports were
carefully planned. The goal was to streamline these processes,
making them as efficient and user-friendly as possible.
6. Prototyping:
• Early prototypes of Expense Tracker were developed to provide a
tangible look and feel of the application. These prototypes were
instrumental in initial user testing and gathering feedback.
7. Feedback Incorporation:
• Feedback from potential users and other stakeholders was actively
sought and integrated into the design. This step ensured that the
application would align effectively with user needs and
expectations.
8. Compliance and Security Planning:
• The design incorporated considerations for compliance with
relevant data protection and privacy regulations. Security features
such as encryption, secure data storage, and user authentication
were key components of the design.
9. Sustainability and Eco-friendliness:

8
• In line with contemporary digital product standards, the design
included features that encourage eco-friendly practices, such as
digital receipts and reports to reduce paper use.
The system design phase for Expense Tracker was exhaustive and detailed,
focusing on creating a solution that was not only technically sound and feature-
rich but also highly user-centric and adaptable to changing user needs and
technological advancements. The goal was to deliver a personal finance
management tool that was both practical and pleasant to use, encouraging better
financial management practices among its users.

9
4. SYSTEM PLANNING

System planning for Expense Tracker involves a strategic approach to define the
project's timeline, allocate resources effectively, and set key developmental
milestones. This planning phase is essential to ensure the project's successful
execution within the defined constraints.

1. Outline of Project Scope for Expense Tracker


The scope of the Expense Tracker project is defined by its intended
functionalities, target user groups, and system capabilities. This outline provides
clarity on the project deliverables, guiding focused development and setting
clear expectations.
Intended Functionalities
1. User Account Management:
• Login and registration functionality.
• User profile management.
2. Expense Tracking:
• Adding, updating, and removing expense entries.
• Categorization of expenses for better organization.
3. Budget Management:
• Setting and tracking personal budgets.
• Alerts for budget limits.
4. Reporting and Analytics:
• Detailed expense reports and insights.
• Interactive charts and graphs for visual representation of
spending patterns.
5. Dashboard:
• Overview of recent expenses and budget status.
• Visual summaries and analytics.
Target User Groups

10
• Individuals seeking a comprehensive tool for personal finance
management.
• Users with varying levels of financial literacy, from beginners to
those well-versed in budgeting and expense tracking.
System Capabilities
• Cross-Platform Functionality: Accessible on various operating
systems, optimized for desktop use.
• Data Security and Privacy: Adherence to data protection
regulations, ensuring user data security.
• Scalability: Capability to handle an expanding user base and
evolving feature set.
• User-Friendly Interface: Intuitive and easy-to-navigate design.
• Customization: Options to personalize settings and preferences.
• Automated Alerts and Reminders: Notifications for important
financial events and milestones.
• Real-Time Data Processing: Immediate updates for expense
entries and budget changes.
2. Project Timeline and Milestones
• Phase 1: Research and Analysis (Month 1): Market research, user
requirement gathering, and system feasibility analysis.
• Phase 2: Design (Months 2-3): UI/UX design, database schema
development, and system architecture design.
• Phase 3: Development (Months 4-6): Coding of the application,
feature implementation, and initial testing.
• Phase 4: Testing and Refinement (Months 7-8): Comprehensive
testing, including unit, integration, and user acceptance testing,
followed by bug fixing and system refinement.
• Phase 5: Deployment and Launch (Month 9): Final deployment,
user documentation, and launch of the application.
• Phase 6: Post-Launch Support and Updates (Ongoing): Regular
updates, feature enhancements, and user support.
3. Resource Allocation

11
• Allocation of development team, including frontend and backend
developers, UI/UX designers, and QA testers.
• Budget planning for software tools, cloud services, and marketing
efforts.
4. Risk Management and Mitigation Strategies
• Identification of potential risks such as development delays,
security vulnerabilities, and user adoption challenges.
• Development of contingency plans and mitigation strategies for
identified risks.
Through careful system planning, Expense Tracker is positioned to be a reliable
and efficient tool for personal finance management, meeting the specific needs
of its target users and adapting to the evolving landscape of financial
management tools.

2. Scope Limitations of Expense Tracker


While Expense Tracker is developed to provide a robust and user-friendly
solution for personal finance management, it is important to delineate its scope
limitations. Setting these boundaries is crucial for managing user expectations
and ensuring clarity on the application's capabilities. The following limitations
outline what is outside the scope of the Expense Tracker project:
1. Simple Expense Logging:
• A straightforward feature allowing users to quickly log expenses,
categorizing them by type (e.g., groceries, utilities) with minimal
input.
2. Basic Budget Setting:
• Users can set up simple monthly or weekly budgets for different
categories and receive notifications when approaching these limits.
3. Visual Expense Overview:
• A feature providing basic visualizations, like pie charts or bar
graphs, showing the distribution of expenses across different
categories.
4. Expense History:
• A chronological view of past expenses, allowing users to scroll
through their expense history easily.
12
5. Quick Search Functionality:
• A search bar to quickly find past expenses based on keywords,
categories, or dates.
6. Manual Data Export:
• An option for users to manually export their expense data as a CSV
or PDF file for personal record-keeping.
7. Recurring Expense Tracker:
• A feature to track recurring expenses (like subscriptions or rent)
where users can set up a recurring expense profile.
8. Simple Notifications:
• Basic alerts or reminders for upcoming budget limits or recurring
expense due dates.
9. Customizable Categories:
• Allows users to create and customize their expense categories
according to their personal spending habits.
10. Monthly Summary Reports:
• Auto-generated simple reports that give users a summary of their
monthly spending.
These features are designed to enhance the core functionality of Expense
Tracker, making it a more effective tool for personal finance management while
keeping the system straightforward and user-friendly.

3. Technology Resources for Expense Tracker


For the development and seamless operation of Expense Tracker, a strategic
selection of technology resources is essential. These resources are carefully
chosen to align with the project's goals and operational requirements, with
MySQL as the database management system. Here's an overview of the key
technology resources for Expense Tracker:
Software Tools
1. Java Development Kit (JDK):
• Foundation for developing Expense Tracker, leveraging Java's
robust libraries and runtime environment.
2. JavaFX SDK:
13
• Enables the creation of a dynamic and intuitive user interface for
the desktop application.
3. MySQL Database Server:
• Handles all data storage needs, from expense records to user
profiles, offering robustness and scalability for managing complex
datasets.
4. Git:
• Vital for version control, facilitating efficient source code
management, tracking changes, and supporting collaborative
development efforts.
5. IntelliJ IDEA:
• The chosen Integrated Development Environment (IDE) for its
comprehensive toolset, enhancing Java and JavaFX development.
6. Apache Maven:
• Utilized for project management and build automation,
streamlining project dependencies and build processes.
Development Environments
1. Cross-Platform Development:
• While primarily developed for Windows, ensuring compatibility
with other major operating systems like macOS and Linux.
Platforms
1. Desktop Application:
• Focused on delivering a responsive and high-performance desktop
application experience, tailored for personal finance management.
With these technology choices, Expense Tracker is positioned to be an effective,
user-friendly personal finance management tool. The integration of Java and
JavaFX forms a strong foundation for the application. MySQL DBMS offers a
reliable and scalable solution for data management. The combination of IntelliJ
IDEA and Maven supports a productive development environment.
Emphasizing cross-platform compatibility, Expense Tracker aims to reach a
broad user base, enhancing its utility and accessibility.

4. Project Timeline for Expense Tracker (3 Months)

14
To complete the Expense Tracker project within an ambitious timeline of 3
months, a focused and expedited approach is essential. Below is the proposed
timeline structured to meet this goal:
Month 1: Conceptualization, Design, and Initial Development
• Weeks 1-2: Conceptualization and Design
• Conduct rapid requirement gathering and analysis.
• Perform streamlined market research to identify key features.
• Finalize the technology stack, focusing on Java, JavaFX, and
MySQL.
• Develop basic user personas and outline primary use cases.
• Sketch initial UI/UX design wireframes and system architecture.
• Set up the development environment and version control with Git.
• Weeks 3-4: Initial Development
• Begin coding core functionalities, prioritizing expense tracking and
budgeting features.
• Initial setup of the MySQL database and integration with backend.
• Start developing basic UI components based on wireframes.
Month 2: Intensive Development and Preliminary Testing
• Weeks 5-6: Continued Development
• Intensify development efforts, focusing on remaining key features.
• Backend development and database enhancements.
• Further develop and refine UI components.
• Weeks 7-8: Testing and Refinement
• Begin unit testing of individual components.
• Conduct initial integration testing.
• Address and fix identified bugs and issues.
• Start preliminary performance and security assessments.
Month 3: Final Development, Comprehensive Testing, and Deployment
• Weeks 9-10: Final Development and Enhanced Testing

15
• Complete development of all planned features.
• Undertake comprehensive testing, including User Acceptance
Testing (UAT).
• Implement refinements based on feedback and continue bug fixing.
• Prepare for deployment, including finalizing launch plans and user
documentation.
• Weeks 11-12: Deployment and Post-Launch Support
• Deploy Expense Tracker to the production environment.
• Monitor system performance and address any immediate issues.
• Conduct brief user training sessions and distribute documentation.
• Perform a post-launch review to identify any urgent fixes or
improvements.
Key Milestones
• End of Week 2: Completion of design phase and commencement of
development.
• End of Month 1: Core functionalities in place and initial testing
underway.
• End of Month 2: Completion of all primary features and advanced
testing phase.
• End of Month 3: Full deployment of Expense Tracker and execution of
post-launch activities.
This timeline is ambitious and requires diligent project management, efficient
resource utilization, and a commitment to meeting deadlines while maintaining
high standards of quality.

16
5. Risk Identification for Expense Tracker Project
Identifying potential risks is crucial for the successful completion of the
Expense Tracker project. Being aware of these risks from the outset allows for
proactive planning and mitigation strategies. Here are the primary risks that
could impact the project, including technical challenges, resource constraints,
and external factors:
1. Complexity in Application Development:
• Risk: Challenges in implementing specific features, such as user-
friendly interfaces or complex data analytics.
• Impact: Potential delays in development or compromises in
application functionality.
2. Resource Limitations:
• Risk: Insufficient team members or lack of specific technical
expertise in areas like JavaFX.
• Impact: Project delays, increased workload for team members, or
need for additional support.
3. Constrained Timeline:
• Risk: The short timeline may be challenging for thorough
development and testing.
• Impact: Possible scaling back of features or compromised
software quality.
4. Software Bugs and Quality Assurance:
• Risk: Late discovery of critical bugs or quality issues during
development.
• Impact: Last-minute fixes impacting project schedule and
potentially the deployment phase.
5. Evolving User Requirements:
• Risk: Changes in user needs or feedback leading to adjustments in
the project scope.
• Impact: Possible delays or redesign of features, affecting the
development timeline.
6. Data Security and Privacy Issues:

17
• Risk: Vulnerabilities in software security or non-compliance with
data protection standards.
• Impact: Legal complications, loss of user trust, and potential
security breaches.
7. Dependence on Specific Technologies:
• Risk: Heavy reliance on certain technologies or tools that may
become obsolete or unsupported.
• Impact: Unplanned updates or changes in technology, affecting
development progress.
8. Budgetary Constraints:
• Risk: Unexpected costs exceeding the planned budget.
• Impact: Possible need for additional funding or reduction in
project scope.
9. Market Dynamics and Competition:
• Risk: Shifts in market trends or emergence of competing
applications during the development phase.
• Impact: Impact on the application's market relevance or
competitive position at launch.
10. User Engagement and Adoption:
• Risk: Challenges in user acceptance due to factors like ease of use
or market awareness.
• Impact: Low initial user engagement, affecting the application's
overall success and value.
Addressing these risks involves careful planning, flexible project management,
and regular reassessment of strategies to ensure that Expense Tracker not only
meets its development goals but also effectively serves its intended user base.

6. Mitigation Strategies for Identified


Ensuring the smooth progression and success of the Expense Tracker project,
especially in a setting where resources like time and expertise might be limited,
requires effective strategies to mitigate potential risks. Here are approaches to
address each identified risk:
1. Complexity in Application Development:
18
• Strategy: Break down the project into smaller, manageable
modules, allowing for focused development. Regularly conduct
integration testing to ensure compatibility and seamless function of
different parts.
2. Resource Limitations:
• Strategy: Carry out a thorough analysis of required resources
versus available resources. If needed, explore options like seeking
assistance from peers with relevant expertise or utilizing online
resources and communities for support.
3. Constrained Timeline:
• Strategy: Focus on delivering core features that are essential to the
application's functionality. Utilize an iterative development
approach to make adjustments as the project progresses, and be
prepared to revise or remove non-critical features if time becomes
a constraint.
4. Software Bugs and Quality Assurance:
• Strategy: Implement a routine of continuous testing throughout the
development process. Utilize available automated testing tools to
efficiently identify and address bugs early on.
5. Evolving User Requirements:
• Strategy: Regularly gather feedback from peers or potential users
and establish a flexible approach to incorporate necessary changes.
However, set clear limits to changes to avoid project scope creep.
6. Data Security and Privacy Issues:
• Strategy: From the onset, embed data security and privacy best
practices into the development process. Regularly review the
project for compliance with standard data protection guidelines.
7. Dependence on Specific Technologies:
• Strategy: Stay informed about the technologies being used and be
ready to adapt to new or different technologies if necessary. This
may involve keeping up with the latest developments in the tech
used or being open to learning new tools.
8. User Engagement and Adoption:
• Strategy: Plan for an extensive outreach and engagement strategy
post-completion. This could include presenting the project to peers,
19
creating demonstrations, or preparing comprehensive
documentation and tutorials to encourage adoption and usage.
By employing these strategies, the Expense Tracker project is positioned to
navigate through various challenges and achieve its objectives effectively.

20
6. Methodology Adopted, System Implementation

1. Development Methodology for Expense Tracker


Chosen Development Approach: Agile Methodology
1. Agile Fundamentals:
• Agile methodology offers a flexible and iterative approach to
software development. It contrasts with more traditional, linear
methodologies by emphasizing adaptive planning, evolutionary
development, early delivery, and continuous improvement,
alongside a readiness to respond to changes.
2. Rationale for Choosing Agile:
• Flexibility in Development: Agile’s adaptability is ideal for
Expense Tracker, given the variable nature of personal finance
management needs and the likelihood of evolving user
requirements.
• Iterative Releases: Using Agile, Expense Tracker can be
developed in incremental, functional versions, allowing for
ongoing refinement based on real-world feedback and testing.
• Enhanced Collaboration: Agile stresses close collaboration
among developers, project managers, and stakeholders, ensuring
regular feedback loops and alignment with user expectations and
market trends for Expense Tracker.
• Risk Management: The iterative nature of Agile allows for early
issue detection and resolution, minimizing the risk of significant
setbacks as the project progresses.
• Focus on User Value: Prioritizing customer satisfaction and user-
centric development, Agile methodology aligns with Expense
Tracker’s goal of delivering functional and user-friendly features.
3. Implementation of Agile in Expense Tracker:
• Sprints and Iterations: Development will be segmented into bi-
weekly sprints, each targeting the delivery of specific, prioritized
functionalities.
• Daily Stand-ups: Regular brief meetings will help track progress,
address any impediments, and plan daily tasks.

21
• User Stories and Backlog Management: Breaking down features
and requirements into user stories to be maintained in a product
backlog, continuously prioritized and refined.
• Sprint Reviews and Retrospectives: End-of-sprint reviews to
demonstrate new features, and retrospectives to reflect on the sprint
and plan improvements for subsequent ones.
4. Benefits for Expense Tracker:
• Agile methodology is well-suited for the Expense Tracker project,
offering a structured yet adaptable framework. It ensures that the
final product is closely aligned with user needs and market
dynamics and facilitates a responsive and efficient development
process.
Adopting Agile for the Expense Tracker project ensures effective handling of
the complexities and dynamics inherent in developing a personal finance
management tool. This approach enhances the project’s ability to swiftly adapt
to changes, increasing the likelihood of its success and ensuring high levels of
user satisfaction.

2. Development Environment Setup


1. Local Development Machines:
• Developers will use high-performance computers equipped with
necessary hardware specifications (adequate RAM, CPU, and
storage) to handle the software development workload.
• Operating System: Windows, as Expense Tracker is tailored for the
Windows platform.
2. Integrated Development Environment (IDE):
• IntelliJ IDEA will be the primary IDE used for coding, debugging,
and testing the application.
3. Version Control System:
• Git will be utilized for version control, with a remote repository
hosted on platforms like GitHub or Bitbucket for collaboration and
code backup.
4. Database Setup:

22
• Local instances of MySQL will be set up on each developer’s
machine for development and testing purposes.
5. Testing Tools:
• Integration of unit testing and integration testing tools within the
IDE.
• Use of test automation frameworks compatible with the Java
environment.
6. Communication Tools:
• A WhatsApp group for instant communication and daily stand-up
meetings.
• Use of email and Trello for task tracking and documentation.
Production Environment Setup
1. Server Configuration:
• Since Expense Tracker is a desktop application, the production
environment primarily focuses on database servers.
• A dedicated MySQL server with high availability and backup
solutions to ensure data integrity and security.
2. Networking and Security:
• Implementation of firewalls and intrusion detection systems to
secure the server.
• Regular security updates and patches to ensure the protection of
sensitive data.
3. Data Storage and Backup:
• Robust data storage solutions with regular backup schedules.
• Implementation of disaster recovery plans to minimize data loss in
case of server failures.
4. Monitoring Tools:
• Deployment of system monitoring tools for real-time tracking of
server performance, resource utilization, and potential system
anomalies.
5. User Access Management:

23
• Controlled access to the production environment, ensuring that
only authorized personnel can make changes or update the system.

24
7. Details of Hardware & Software Used

1. Hardware Specifications for Expense Tracker


To ensure optimal performance and a seamless user experience, specific
hardware configurations are recommended for both server (for backend data
management) and client-side (where the desktop application is used) for the
Expense Tracker application. Here are the detailed hardware requirements:
Server-Side Hardware Specifications
As Expense Tracker is primarily focused on local data management, server-side
hardware mainly pertains to database servers or potential backend services.
1. Processor:
• A Quad-core CPU (Intel Xeon, Core i5/i7, or equivalent) with a
minimum clock speed of 2.5 GHz for efficient database
management.
2. Memory (RAM):
• Minimum of 8 GB RAM recommended 16 GB or more for
handling large datasets and multiple user connections.
3. Storage:
• Solid-State Drive (SSD) with at least 256 GB of storage for fast
data access and processing. Regular data backup systems in place,
either through additional internal HDDs or cloud-based solutions.
4. Networking:
• Gigabit Ethernet connection for reliable internal network access.
High-speed internet connectivity for remote access, data syncing,
and backups.
5. Power Supply:
• Uninterrupted Power Supply (UPS) system to prevent downtime
and data loss during power outages.
Client-Side Hardware Specifications
For users operating the Expense Tracker desktop application:
1. Processor:
• Dual-core processor (Intel i3/i5/i7 or equivalent) with a minimum
clock speed of 2.0 GHz.

25
2. Memory (RAM):
• Minimum of 4 GB RAM, with 8 GB recommended for smooth
application performance.
3. Storage:
• At least 250 GB HDD or SSD to accommodate the application and
data storage.
4. Graphics:
• Integrated graphics capable of supporting at least 1280x720
resolution. Higher resolution support and dedicated graphics are
beneficial for an enhanced UI experience.
5. Operating System:
• Windows 10 or later versions, considering the application’s
optimization for Windows.
6. Networking:
• Standard Ethernet or Wi-Fi connection for online functionalities
like updates and data syncing.
7. Additional Requirements:
• At least one USB port for external backups or data transfer.
• A monitor supporting a minimum resolution of 1280x720, with
higher resolutions recommended for better usability.
These specifications aim to ensure that Expense Tracker operates efficiently and
reliably on a wide range of systems, balancing performance with affordability.
Adjustments to these requirements might be necessary based on future software
updates or evolving user needs.

2. Software Stack for Expense Tracker


The software stack for Expense Tracker is carefully selected to ensure the
application is reliable, performant, and meets all system requirements. The stack
comprises various programming languages, frameworks, and tools, each chosen
for its proven capabilities and compatibility with the application's goals. Here's
a detailed breakdown:
Programming Languages
1. Java:
26
• The core language for developing Expense Tracker. Java's cross-
platform capabilities and extensive libraries make it ideal for
building robust and maintainable desktop applications.
2. SQL (for Database Interactions):
• SQL will be utilized for crafting database queries and managing
interactions between the Expense Tracker application and the
MySQL database.
Development Frameworks and Libraries
1. JavaFX:
• Chosen for developing the graphical user interface (GUI). JavaFX
offers comprehensive features for creating modern, interactive user
interfaces.
2. JDBC (Java Database Connectivity):
• JDBC will provide the bridge between the Java application and the
MySQL database, enabling operations like data queries, updates,
and retrieval.
Integrated Development Environment (IDE)
1. IntelliJ IDEA:
• Selected as the primary IDE for development. IntelliJ IDEA
supports Java and JavaFX with advanced coding assistance, smart
navigation, and integrated tools for efficient coding and debugging.

Database Management System


1. MySQL:
• Serving as the backend database system, MySQL will manage all
data for Expense Tracker, including user profiles, expense records,
budget data, and financial reports.

Version Control
1. Git:
• Essential for version control, Git facilitates effective change
tracking, collaborative development, and code management. The

27
code repository will likely be hosted on platforms like GitHub or
Bitbucket.
Build Tool
1. Apache Maven:
• Utilized for project build automation and dependency management,
Maven ensures a consistent build process across different
development environments.
This software stack ensures that Expense Tracker is built on a foundation of
reliable and well-supported technologies, providing a robust structure for the
application's development and future scalability. The combination of Java and
JavaFX for front-end development, MySQL for data management, and
supportive tools like IntelliJ IDEA and Maven creates an efficient and cohesive
development environment.

28
8. System Maintenance

Maintenance Plan for Expense Tracker


For the Expense Tracker project, a streamlined and realistic maintenance plan is
essential to ensure its ongoing success and functionality. This plan is adapted to
fit the scale and resources typically available in a smaller-scale project:
Regular Software Updates
1. Update Schedule:
• Implement a feasible schedule for software updates. Plan to release
minor updates periodically, such as at the end of each semester,
with a focus on essential fixes and enhancements.
• Notify users about upcoming updates through the application's
notification system or via email.
2. Feature Enhancements:
• Regularly review user feedback, if available, to identify potential
improvements or new features. Prioritize updates based on their
impact and feasibility.
3. Compatibility Checks:
• Ensure each update is compatible with commonly used operating
systems and doesn’t introduce new issues.
Bug Fixing and Issue Resolution
1. Issue Tracking:
• Utilize a basic issue tracking mechanism, like a shared spreadsheet
or a free online tool, to log and prioritize reported bugs or issues.
2. Patch Releases:
• Plan for quick fixes for critical bugs. Regularly review the
application to proactively identify and address potential issues.
Performance Optimization
1. Regular Monitoring:
• Periodically check the application’s performance, focusing on user
experience aspects like response time and ease of use.
2. Optimization Updates:

29
• Make improvements to the codebase as needed to enhance
performance and user experience.
User Support and Feedback
1. User Support System:
• Set up a simple support system, possibly using email or an online
form, to assist users with any queries or issues.
• Maintain an FAQ section or a simple user guide to help users
navigate common challenges.
2. Feedback Loop:
• Encourage users to provide feedback through simple surveys or
direct communication.
Documentation and Training Material Updates
1. Documentation Updates:
• Keep any project documentation, such as user guides or online help
resources, updated with information on recent changes or new
features.
• Accompany updates with brief release notes summarizing the
changes.
2. Training Resources:
• Update any available tutorials or guides to reflect new features or
changes in the application.
Backup and Security
1. Data Backups:
• Regularly back up any data related to the project to prevent loss
due to system failure.
2. Security Checks:
• Conduct basic security checks periodically to ensure the
application remains secure against common vulnerabilities.
This maintenance plan for Expense Tracker is designed to be manageable and
realistic, considering the scale of the project. It emphasizes the importance of
regular updates, user support, and maintaining the application's security and
performance.

30
31
9. Evaluation

Performance Metrics for Expense Tracker


To ensure the Expense Tracker project meets its goals and offers a satisfactory
experience to its users, it's important to measure various aspects of its
performance. The following metrics are tailored to assess the system in a setting
that is manageable and realistic:
1. Application Performance Metrics
• Response Time: Track the time taken by the application to respond
to user inputs. A quicker response time indicates better
performance.
• Load Time: Monitor how long it takes for the application to start
and be ready for use. This is important for initial user impressions.
• Resource Usage: Measure the application's consumption of system
resources like CPU and memory, ensuring it runs efficiently.
2. Usability Metrics
• UI Responsiveness: Assess how smoothly and quickly the UI
reacts to user interactions.
• Ease of Navigation: Evaluate how easily users can move through
the application and access features.
• Error Rate: Monitor the frequency of errors encountered,
including both system errors and user input mistakes.
3. Reliability Metrics
• Uptime/Downtime: Measure the proportion of time the application
is functional and available versus when it is down due to issues or
maintenance.
• Bug Frequency: Track the number of bugs or glitches reported,
indicating the application's stability.
4. Maintenance and Support Metrics
• Resolution Time: Calculate the average time taken to address and
resolve issues or bugs reported by users.
• Support Request Frequency: Keep track of the number of support
requests received to identify areas that might need enhancements or
more user guidance.

32
These metrics offer a broad view of the Expense Tracker's performance,
covering technical efficiency, user experience, and stability. Regular assessment
using these metrics will help in making necessary improvements and ensuring
the application aligns with user needs and expectations in a manageable and
practical manner.

2. Review and Improvement Cycle for Expense Tracker


To maintain and continually enhance the Expense Tracker, a systematic review
and improvement cycle is essential. This cycle will involve regular assessments
of the system, followed by necessary updates and optimizations. Here's an
outline of this process, suited to a smaller-scale project:
1. Regular System Review Schedule
• Frequency of Reviews: Schedule routine reviews, such as at the
end of significant development milestones or monthly.
• Scope of Reviews: Assess various components like software
performance, user feedback, and any reported issues.
2. Performance Analysis
• Monitoring Tools: Utilize basic performance monitoring tools to
gather data on system response times, load times, and error
occurrences.
• Analysis Reports: Create reports for each review cycle to identify
performance issues or optimization needs.
3. User Feedback Collection
• Surveys and Feedback Forms: Collect user feedback periodically
through simple surveys or feedback mechanisms.
• User Forum Monitoring: If there’s a user community, monitor it
for insights into user experiences and potential areas for
improvement.
4. Issue and Bug Tracking
• Bug Tracking System: Implement a simple system for logging and
tracking bugs.
• Prioritization of Fixes: Classify and prioritize bugs, addressing
critical issues promptly.
5. Feature Requests and Enhancement Tracking
33
• Feature Request Log: Keep a record of feature requests from
users.
• Assessment of Requests: Evaluate these requests for their
feasibility and relevance to the application.
6. Implementation of Improvements
• Development Planning: Plan for the incorporation of
improvements in the upcoming development phases.
• Resource Allocation: Assign necessary resources for developing
these improvements.
7. Testing and Deployment of Improvements
• Testing of Enhancements: Ensure thorough testing of new
features or improvements.
• Staged Rollout: Consider a phased approach for major updates,
starting with a smaller user group.
8. Documentation and Training Material Update
• Update Documentation: Regularly update all documentation to
reflect new changes or features.
• Communication to Users: Inform users about updates, focusing
on new functionalities and enhancements.
9. Feedback on Improvements
• Measure Impact: Evaluate the effectiveness of improvements
post-deployment.
• Continual Feedback Loop: Encourage ongoing user feedback to
assess the impact of changes.
This cycle for Expense Tracker is designed to ensure that the application
remains effective, relevant, and user-friendly. By incorporating regular reviews,
feedback, and updates, the project can adapt and grow to meet user needs and
stay abreast of technological advancements.

34
10. DETAILED LIFE CYCLE

10.1 ERD (ENTITY-RELATIONSHIP DIAGRAM)

10.2 DFD (DATA FLOW DIAGRAM)

10.3 METHODOLOGY USED FOR TESTING

1. Integration Testing:

• Testing the integration of different modules of the application to


ensure they work together as expected.

2. System Testing:

• Verifying that the entire system functions according to the specified


requirements.

3. User Acceptance Testing (UAT):

• Conducting testing with actual users to ensure the system meets


their needs and expectations.

10.4 TEST REPORT

35
Sr. No. Test Case Description Status

1 Valid user registration Pass

2 Invalid email format in registration Pass

3 Duplicate email registration Pass

4 Valid user login Pass

5 Invalid login credentials Pass

6 Add new expense entry Pass

7 Edit an existing expense entry Pass

8 Delete an expense entry Pass

9 Set a monthly budget Pass

10 Generate expense report Pass

11 View expense history Pass

12 Search functionality in expense entries Pass

13 Logout functionality Pass

14 Application load time under normal conditions Pass

15 Basic navigation between different modules Pass

36
11. CODING AND SCREENSHOT OF THE PROJECT

1. CODING

1.1 FXML Files

login.fxml
<?xml version="1.0" encoding="UTF-8"?>

<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"


minWidth="-Infinity" prefHeight="800.0" prefWidth="1000.0"
stylesheets="@../../../css/dashboard.css" xmlns="http://javafx.com/javafx/21"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0">
<children>
<HBox prefHeight="800.0" prefWidth="1000.0">
<children>
<StackPane prefHeight="150.0" prefWidth="500.0">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" styleClass="login-left-
container">

37
<children>
<FontAwesomeIconView glyphName="HOME" size="60" />
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Expense
Tracker" />
<Label text="v 1.0.0" />
</children>
</VBox>
</children>
</StackPane>
<StackPane prefHeight="150.0" prefWidth="500.0">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" styleClass="login-right-
container">
<StackPane.margin>
<Insets bottom="150.0" left="10.0" right="10.0" top="150.0" />
</StackPane.margin>
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Login">
<VBox.margin>
<Insets bottom="30.0" />
</VBox.margin>
</Text>
<Label text="Username" />
<TextField fx:id="usernameTextField">
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
</TextField>
<Label text="Password" />
<PasswordField fx:id="passwordTextField">
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
</PasswordField>

38
<Button fx:id="loginButton" mnemonicParsing="false"
onAction="#onLoginButton" prefHeight="32.0" prefWidth="445.0" text="Login">
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
</Button>
<Button fx:id="registerButton" mnemonicParsing="false"
onAction="#onRegisterButton" prefWidth="445.0" text="Register">
<VBox.margin>
<Insets bottom="20.0" />
</VBox.margin>
</Button>
<Label fx:id="loginErrorLabel" styleClass="error-label" text="Label">
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
</Label>
</children>
</VBox>
</children>
</StackPane>
</children>
</HBox>
</children>
</VBox>
</children>
</AnchorPane>

39
register.fxml
<?xml version="1.0" encoding="UTF-8"?>

<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"


minWidth="-Infinity" prefHeight="800.0" prefWidth="1000.0"
stylesheets="@../../../css/dashboard.css" xmlns="http://javafx.com/javafx/21"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0">
<children>
<HBox prefHeight="800.0" prefWidth="1000.0">
<children>
<StackPane prefHeight="150.0" prefWidth="500.0">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" styleClass="login-left-
container">
<children>
<FontAwesomeIconView glyphName="HOME" size="60" />
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Expense
Tracker" />

40
<Label text="v 1.0.0" />
</children>
</VBox>
</children>
</StackPane>
<StackPane prefHeight="150.0" prefWidth="500.0">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" styleClass="login-right-
container">
<StackPane.margin>
<Insets bottom="150.0" left="10.0" right="10.0" top="150.0" />
</StackPane.margin>
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Register">
<VBox.margin>
<Insets bottom="30.0" />
</VBox.margin>
</Text>
<Label text="Username" />
<TextField fx:id="usernameTextField">
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
</TextField>
<Label text="Password" />
<PasswordField fx:id="passwordTextField">
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
</PasswordField>
<Label text="Repeat Password" />
<PasswordField fx:id="repeatPasswordTextField">
<VBox.margin>
<Insets bottom="15.0" />

41
</VBox.margin>
</PasswordField>
<Button fx:id="registerButton" mnemonicParsing="false"
onAction="#onRegisterButton" prefWidth="445.0" text="Register">
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
</Button>
<Button fx:id="loginButton" mnemonicParsing="false"
prefWidth="445.0" text="Login">
<VBox.margin>
<Insets bottom="20.0" />
</VBox.margin>
</Button>
<Label fx:id="errorLabel" styleClass="error-label" text="Label">
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
</Label>
</children>
</VBox>
</children>
</StackPane>
</children>
</HBox>
</children>
</VBox>
</children>
</AnchorPane>

42
dashboard.fxml
<?xml version="1.0" encoding="UTF-8"?>

<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.chart.PieChart?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"


minWidth="-Infinity" prefHeight="800.0" prefWidth="1000.0"
stylesheets="@../../../css/dashboard.css" xmlns="http://javafx.com/javafx/21"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox layoutX="-151.0" layoutY="8.0" prefHeight="100.0" prefWidth="1000.0"
AnchorPane.bottomAnchor="700.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<StackPane prefHeight="100.0" prefWidth="500.0">
<children>
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="date-picker-
container">

43
<children>
<ComboBox fx:id="monthPicker" onAction="#onMonthSelect"
prefWidth="150.0" styleClass="hbox-centered" />
<ComboBox fx:id="yearPicker" onAction="#onYearSelect"
prefWidth="150.0" />
<Button fx:id="currentMonthBtn" mnemonicParsing="false"
onAction="#onCurrentMonthBtnClicked" text="Current Month">
<HBox.margin>
<Insets left="20.0" />
</HBox.margin>
</Button>
</children>
</HBox>
</children>
</StackPane>
<StackPane prefHeight="100.0" prefWidth="500.0" styleClass="add-expense-
container">
<children>
<Button fx:id="addExpenseButton" mnemonicParsing="false"
onAction="#onAddExpenseButtonClicked" text="Add Expense">
<graphic>
<FontAwesomeIconView glyphName="PLUS" size="20" />
</graphic>
</Button>
</children></StackPane>
</children>
</HBox>
</children>
</VBox>
<VBox layoutX="75.0" layoutY="300.0" prefHeight="200.0" prefWidth="100.0"
AnchorPane.bottomAnchor="100.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="100.0">
<children>
<HBox prefHeight="700.0" prefWidth="1000.0">

44
<children>
<StackPane prefHeight="700.0" prefWidth="700.0">
<children>
<Pane prefHeight="200.0" prefWidth="200.0">
<children>
<Label layoutX="26.0" layoutY="14.0" text="Search" />
<TableView fx:id="tableView" layoutX="26.0" layoutY="47.0"
prefHeight="544.0" prefWidth="650.0">
<columns>
<TableColumn fx:id="dateTableColumn"
prefWidth="96.80001831054688" text="Date" />
<TableColumn fx:id="typeTableColumn"
prefWidth="190.39999389648438" text="Type" />
<TableColumn fx:id="categoryTableColumn" minWidth="0.0"
prefWidth="119.20001220703125" text="Category" />
<TableColumn fx:id="amountTableColumn"
prefWidth="136.79998779296875" text="Amount" />
<TableColumn fx:id="noteTableColumn"
prefWidth="97.5999755859375" text="Note" />
</columns>
</TableView>
<TextField layoutX="83.0" layoutY="10.0" prefHeight="25.0"
prefWidth="593.0" />
</children>
</Pane>
</children>
</StackPane>
<StackPane prefHeight="150.0" prefWidth="300.0">
<children>
<Pane prefHeight="200.0" prefWidth="200.0" styleClass="pane-container">
<children>
<Label layoutX="14.0" layoutY="14.0" styleClass="total-expense-header-
text" text="Expense Details" />
<Label layoutX="14.0" layoutY="47.0" styleClass="total-expense-title-

45
text" text="Income" />
<Label fx:id="incomeLabel" layoutX="100.0" layoutY="44.0"
styleClass="total-expense-income-amt-text" text="0.0" />
<Label layoutX="14.0" layoutY="69.0" styleClass="total-expense-title-
text" text="Expense" />
<Label fx:id="expenseLabel" layoutX="100.0" layoutY="69.0"
styleClass="total-expense-expense-amt-text" text="0.0" />
<Label layoutX="14.0" layoutY="97.0" styleClass="total-expense-title-
text" text="Total" />
<Label fx:id="totalLabel" layoutX="100.0" layoutY="94.0"
styleClass="total-expense-total-amt-text" text="0.0" />
<Label layoutX="9.0" layoutY="242.0" styleClass="total-expense-title-
text" text="Chart" />
<PieChart fx:id="pieChart" layoutX="18.0" layoutY="299.0"
prefHeight="182.0" prefWidth="255.0" />
</children>
</Pane>
</children>
<HBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</HBox.margin>
</StackPane>
</children>
</HBox>
</children>
</VBox>
<VBox layoutX="10.0" layoutY="10.0" prefHeight="200.0" prefWidth="100.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="700.0">
<children>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<StackPane prefHeight="100.0" prefWidth="500.0">
<children>

46
<VBox prefHeight="200.0" prefWidth="100.0" styleClass="footer-title-
container">
<children>
<FontAwesomeIconView size="20" />
<Label text="Expense Tracker" />
<Label styleClass="version-label" text="v 1.0.0" />
</children>
</VBox>
</children>
</StackPane>
<StackPane prefHeight="100.0" prefWidth="500.0">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" styleClass="footer-copyright-
container">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Report Bugs?"
/>
<Label text="Use this to report any errors or suggestions" />
<Button fx:id="reportBugButton" mnemonicParsing="false"
text="Report">
<graphic>
<FontAwesomeIconView glyphName="BUG" size="12" />
</graphic>
</Button>
</children>
</VBox>
</children>
</StackPane>
</children>
</HBox>
</children>
</VBox>
</children>
</AnchorPane>

47
48
add-expense.fxml
<?xml version="1.0" encoding="UTF-8"?>

<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"


minWidth="-Infinity" prefHeight="800.0" prefWidth="1000.0"
stylesheets="@../../../css/dashboard.css" xmlns="http://javafx.com/javafx/21"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox layoutX="-151.0" layoutY="8.0" prefHeight="100.0" prefWidth="1000.0"
AnchorPane.bottomAnchor="700.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<StackPane prefHeight="100.0" prefWidth="500.0">
<children>
<HBox prefHeight="100.0" prefWidth="200.0" styleClass="date-picker-
container">

49
<children>
<ComboBox disable="true" prefWidth="150.0" styleClass="hbox-
centered" />
<ComboBox disable="true" prefWidth="150.0" />
<Button disable="true" mnemonicParsing="false" text="Current Month">
<HBox.margin>
<Insets left="20.0" />
</HBox.margin>
</Button>
</children>
</HBox>
</children>
</StackPane>
<StackPane prefHeight="100.0" prefWidth="500.0" styleClass="add-expense-
container">
<children>
<Button disable="true" mnemonicParsing="false" text="Add Expense">
<graphic>
<FontAwesomeIconView glyphName="PLUS" size="20" />
</graphic>
</Button>
</children>
</StackPane>
</children>
</HBox>
</children>
</VBox>
<VBox layoutX="75.0" layoutY="300.0" prefHeight="200.0" prefWidth="100.0"
AnchorPane.bottomAnchor="100.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="100.0">
<children>
<HBox prefHeight="700.0" prefWidth="1000.0">
<children>
<Pane prefHeight="700.0" prefWidth="1045.0" styleClass="add-expense-

50
dashboard-container">
<children>
<Label layoutX="345.0" layoutY="84.0" text="Date" />
<DatePicker fx:id="datePicker" layoutX="452.0" layoutY="80.0"
prefHeight="25.0" prefWidth="200.0" promptText="Pick a Date" />
<ChoiceBox fx:id="categorySelector" layoutX="454.0" layoutY="187.0"
prefHeight="25.0" prefWidth="200.0" />
<ComboBox fx:id="typeSelector" layoutX="452.0" layoutY="139.0"
onAction="#onTypeSelectorChange" prefHeight="33.0" prefWidth="200.0" />
<TextField fx:id="amountTextField" layoutX="455.0" layoutY="243.0"
prefHeight="25.0" prefWidth="200.0" />
<TextArea fx:id="noteTextArea" layoutX="454.0" layoutY="292.0"
prefHeight="200.0" prefWidth="200.0" />
<Label layoutX="345.0" layoutY="191.0" text="Category" />
<Label layoutX="346.0" layoutY="139.0" text="Type" />
<Label layoutX="346.0" layoutY="247.0" text="Amount" />
<Label layoutX="348.0" layoutY="388.0" text="Note" />
<Button fx:id="expenseSubmitButton" layoutX="455.0" layoutY="530.0"
mnemonicParsing="false" onAction="#onAddExpenseButton" prefHeight="25.0"
prefWidth="200.0" text="Submit" />
</children>
</Pane>
</children>
</HBox>
</children>
</VBox>
<VBox prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="700.0">
<children>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<StackPane prefHeight="100.0" prefWidth="500.0">
<children>

51
<VBox prefHeight="200.0" prefWidth="100.0" styleClass="footer-title-
container">
<children>
<FontAwesomeIconView size="20" />
<Label text="Expense Tracker" />
<Label styleClass="version-label" text="v 1.0.0" />
</children>
</VBox>
</children>
</StackPane>
<StackPane prefHeight="100.0" prefWidth="500.0">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" styleClass="footer-copyright-
container">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Report Bugs?"
/>
<Label text="Use this to report any errors or suggestions" />
<Button mnemonicParsing="false" text="Report">
<graphic>
<FontAwesomeIconView glyphName="BUG" size="12" />
</graphic>
</Button>
</children>
</VBox>
</children>
</StackPane>
</children>
</HBox>
</children>
</VBox>
</children>
</AnchorPane>

52
53
1.1.2 Controllers
LoginController
package org.bekoder.expensetracker.controllers;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;

import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import java.util.ResourceBundle;

import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.bekoder.expensetracker.Application;
import org.bekoder.expensetracker.bootstrap.Instantiator;
import org.bekoder.expensetracker.dao.UserDAO;

public class LoginController implements Initializable {

private final UserDAO userDAO;

public LoginController(UserDAO userDAO) {


this.userDAO = userDAO;
}

@FXML
private TextField usernameTextField;

@FXML
private PasswordField passwordTextField;

@FXML
private Button loginButton;

@FXML
private Button registerButton;

@FXML
private Label loginErrorLabel;

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
loginErrorLabel.setVisible(false);
}

@FXML
private void onLoginButton() {

54
System.out.println("Login button clicked");
String username = usernameTextField.getText();
String password = passwordTextField.getText();
try {
if (userDAO.checkLogin(username, password)) {
loginErrorLabel.setVisible(false);

int userId = userDAO.getUserId(username, password);

DashboardController dashboardController =
Instantiator.getDashboardControllerInstance(userId);

// Open the dashboard window


FXMLLoader fxmlLoader = new
FXMLLoader(Application.class.getResource("dashboard.fxml"));
fxmlLoader.setController(dashboardController);
Parent root = fxmlLoader.load();

Stage registerStage = new Stage();


registerStage.initModality(Modality.NONE);
registerStage.initStyle(StageStyle.UTILITY);
registerStage.setTitle("Dashboard");
registerStage.setScene(new Scene(root));
registerStage.show();

// Close the current window


Stage currentStage = (Stage) loginErrorLabel.getScene().getWindow();
currentStage.close();

} else {
loginErrorLabel.setVisible(true);
loginErrorLabel.setText("Invalid username or password");
System.out.println("Login failed");
}
} catch (SQLException | IOException e) {
throw new RuntimeException(e);
}
}

@FXML
private void onRegisterButton() {
System.out.println("Register button clicked");
try {
FXMLLoader fxmlLoader = new
FXMLLoader(Application.class.getResource("register.fxml"));
fxmlLoader.setController(Instantiator.registrationController);
Parent root = fxmlLoader.load();

Stage currentStage = (Stage) registerButton.getScene().getWindow();


currentStage.close();

Stage registerStage = new Stage();


registerStage.initModality(Modality.APPLICATION_MODAL);
registerStage.initStyle(StageStyle.UTILITY);
registerStage.setTitle("Register");
registerStage.setScene(new Scene(root));
registerStage.show();

55
} catch (IOException e) {
throw new RuntimeException(e);
}
}

56
RegistrationController
package org.bekoder.expensetracker.controllers;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.bekoder.expensetracker.Application;
import org.bekoder.expensetracker.bootstrap.Instantiator;
import org.bekoder.expensetracker.dao.UserDAO;

import java.net.URL;
import java.util.ResourceBundle;

public class RegistrationController implements Initializable {

private final UserDAO userDAO;

public RegistrationController(UserDAO userDAO) {


this.userDAO = userDAO;
}

@FXML
private TextField usernameTextField;

@FXML
private PasswordField passwordTextField;

@FXML
private PasswordField repeatPasswordTextField;

@FXML
private Label errorLabel;

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
errorLabel.setVisible(false);
}

@FXML
private void onRegisterButton() {
System.out.println("Register button clicked from RegistrationController");
try {
String username = usernameTextField.getText();
String password = passwordTextField.getText();

57
String repeatPassword = repeatPasswordTextField.getText();
if (password.equals(repeatPassword)) {
if (userDAO.isUsernameExists(username)) {
errorLabel.setVisible(true);
errorLabel.setText("Username already exists");
} else {
userDAO.addUser(username, password);
int userId = userDAO.getUserId(username, password);
DashboardController dashboardController =
Instantiator.getDashboardControllerInstance(userId);

// Open the dashboard window


FXMLLoader fxmlLoader = new
FXMLLoader(Application.class.getResource("dashboard.fxml"));
fxmlLoader.setController(dashboardController);
Parent root = fxmlLoader.load();

Stage registerStage = new Stage();


registerStage.initModality(Modality.APPLICATION_MODAL);
registerStage.initStyle(StageStyle.UTILITY);
registerStage.setTitle("Dashboard");
registerStage.setScene(new Scene(root));
registerStage.show();

// Close the current window


Stage currentStage = (Stage) errorLabel.getScene().getWindow();
currentStage.close();

} else {
errorLabel.setVisible(true);
errorLabel.setText("Passwords do not match");
}
} catch (Exception e) {
e.printStackTrace();
}
}

58
DashboardController
package org.bekoder.expensetracker.controllers;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.bekoder.expensetracker.Application;
import org.bekoder.expensetracker.ExpenseTableView;
import org.bekoder.expensetracker.bootstrap.Instantiator;
import org.bekoder.expensetracker.dao.ExpenseDAO;
import org.bekoder.expensetracker.dao.entites.Expense;

import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import java.time.LocalDate;
import java.time.Month;
import java.time.Year;
import java.time.format.TextStyle;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class DashboardController implements Initializable {

private int userId;


private final ExpenseDAO expenseDAO;

public DashboardController(int userId, ExpenseDAO expenseDAO) {


this.userId = userId;
this.expenseDAO = expenseDAO;
}

@FXML
private ComboBox<String> monthPicker;

@FXML
private ComboBox<String> yearPicker;

@FXML

59
private Button currentMonthBtn;

@FXML
private Button addExpenseButton;

@FXML
private Label expenseLabel;

@FXML
private Label incomeLabel;

@FXML
private Label totalLabel;

@FXML
private TableView<ExpenseTableView> tableView;

@FXML
private TableColumn<ExpenseTableView, String> dateTableColumn;

@FXML
private TableColumn<ExpenseTableView, String> typeTableColumn;

@FXML
private TableColumn<ExpenseTableView, String> categoryTableColumn;

@FXML
private TableColumn<ExpenseTableView, String> amountTableColumn;

@FXML
private TableColumn<ExpenseTableView, String> noteTableColumn;

@FXML
private PieChart pieChart;

ObservableList<ExpenseTableView> expenseTableViewObservableList =
FXCollections.observableArrayList();

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
monthPicker.getItems().addAll("January", "February", "March", "April", "May", "June",
"July", "August",
"September", "October", "November", "December");

IntStream.range(2020, 2030).forEach(year ->


yearPicker.getItems().add(String.valueOf(year)));

monthPicker.setValue(LocalDate.now().getMonth().getDisplayName(TextStyle.FULL,
java.util.Locale.US));
yearPicker.setValue(String.valueOf(Year.now().getValue()));

String month = monthPicker.getValue();

60
String year = yearPicker.getValue();

updateDashboard(month, year);

@FXML
private void onYearSelect() {
String month = monthPicker.getValue();
String year = yearPicker.getValue();

updateDashboard(month, year);
}

private void updateTableView(List<Expense> expenses) {


expenseTableViewObservableList.clear();
// update table view with expenses
expenses.forEach(expense -> {
expenseTableViewObservableList.add(new ExpenseTableView(
expense.getDate(),
expense.getType(),
expense.getCategory(),
expense.getAmount(),
expense.getNote()
));
});

dateTableColumn.setCellValueFactory(new PropertyValueFactory<>("date"));
typeTableColumn.setCellValueFactory(new PropertyValueFactory<>("type"));
categoryTableColumn.setCellValueFactory(new PropertyValueFactory<>("category"));
amountTableColumn.setCellValueFactory(new PropertyValueFactory<>("amount"));
noteTableColumn.setCellValueFactory(new PropertyValueFactory<>("note"));

tableView.setItems(expenseTableViewObservableList);

private Map<String, Double> aggregateExpensesByCategory(List<Expense> expenses) {


return expenses.stream()
.collect(Collectors.groupingBy(
Expense::getCategory,
Collectors.summingDouble(Expense::getAmount)
));
}

private void fillPieChartWithData(PieChart pieChart, List<Expense> expenses) {


pieChart.getData().clear();
Map<String, Double> categoryTotals = aggregateExpensesByCategory(expenses);
categoryTotals.forEach((category, total) -> {
PieChart.Data data = new PieChart.Data(category, total);
pieChart.getData().add(data);
});

61
}

private void updateDashboard(String month, String year) {


try {
List<Expense> expenses = expenseDAO.getExpensesByMonthAndYear(userId,
Month.valueOf(month.toUpperCase()).getValue(), Integer.parseInt(year));

double totalExpense = expenseDAO.getTotalExpenseByMonthAndYear(userId,


Month.valueOf(month.toUpperCase()).getValue(), Integer.parseInt(year));

double totalIncome = expenseDAO.getTotalIncomeByMonthAndYear(userId,


Month.valueOf(month.toUpperCase()).getValue(), Integer.parseInt(year));

double totalLeft = totalIncome - totalExpense;

expenseLabel.setText(String.valueOf(totalExpense));

incomeLabel.setText(String.valueOf(totalIncome));

totalLabel.setText(String.valueOf(totalLeft));

updateTableView(expenses);

fillPieChartWithData(pieChart, expenses);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}

@FXML
private void onMonthSelect() {
String month = monthPicker.getValue();
String year = yearPicker.getValue();

updateDashboard(month, year);
}

@FXML
private void onCurrentMonthBtnClicked() {
System.out.println("Current month button clicked");
monthPicker.setValue(LocalDate.now().getMonth().getDisplayName(TextStyle.FULL,
java.util.Locale.US));
yearPicker.setValue(String.valueOf(Year.now().getValue()));

String month = monthPicker.getValue();


String year = yearPicker.getValue();

updateDashboard(month, year);
}

@FXML

62
private void onAddExpenseButtonClicked() {
AddExpenseController addExpenseController =
Instantiator.getAddExpenseControllerInstance(userId, expenseDAO);

try {
FXMLLoader fxmlLoader = new FXMLLoader(Application.class.getResource("add-
expense.fxml"));
fxmlLoader.setController(addExpenseController);
Parent root = fxmlLoader.load();

Stage currentStage = (Stage) addExpenseButton.getScene().getWindow();


currentStage.close();

Stage registerStage = new Stage();


registerStage.initModality(Modality.APPLICATION_MODAL);
registerStage.initStyle(StageStyle.UTILITY);
registerStage.setTitle("Register");
registerStage.setScene(new Scene(root));
registerStage.show();

} catch (IOException e) {
throw new RuntimeException(e);
}

63
AddExpenseController
package org.bekoder.expensetracker.controllers;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.bekoder.expensetracker.Application;
import org.bekoder.expensetracker.bootstrap.Instantiator;
import org.bekoder.expensetracker.dao.ExpenseDAO;
import org.bekoder.expensetracker.dao.entites.Expense;

import java.net.URL;
import java.sql.SQLException;
import java.util.ResourceBundle;

public class AddExpenseController implements Initializable {

private final int userId;


private final ExpenseDAO expenseDAO;

public AddExpenseController(int userId, ExpenseDAO expenseDAO) {


this.expenseDAO = expenseDAO;
this.userId = userId;
}

//Create a list of Expense Category


private final String[] expenseCategory = {"Food", "Transportation", "House",
"Entertainment", "Clothes", "Health",
"Gifts", "Other"};

// Create a list of income category


private final String[] incomeCategory = {"Salary", "Gifts", "Other"};

@FXML
private void onTypeSelectorChange() {
categorySelector.getItems().clear();
if (typeSelector.getValue().equals("Income")) {
categorySelector.getItems().addAll(incomeCategory);
} else {
categorySelector.getItems().addAll(expenseCategory);
}
}

@Override

64
public void initialize(URL url, ResourceBundle resourceBundle) {
typeSelector.getItems().addAll("Income", "Expense");
categorySelector.getItems().clear();

amountTextField.setText("0");

amountTextField.textProperty().addListener((observable, oldValue, newValue) -> {


if (!newValue.matches("\\d*")) { // Regular expression for numeric characters
amountTextField.setText(newValue.replaceAll("[^\\d]", "")); // Remove non-
numeric characters
}
});
}

@FXML
private DatePicker datePicker;

@FXML
private ComboBox<String> typeSelector;

@FXML
private ChoiceBox<String> categorySelector;

@FXML
private TextField amountTextField;

@FXML
private TextArea noteTextArea;

@FXML
private void onAddExpenseButton() {

Expense expense = new Expense(


0,
userId,
java.sql.Date.valueOf(datePicker.getValue()),
typeSelector.getValue(),
categorySelector.getValue(),
Double.parseDouble(amountTextField.getText()),
noteTextArea.getText()
);
try {
expenseDAO.addExpense(expense);
closeThisAndOpenDashboard();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}

private void closeThisAndOpenDashboard() {


try {
DashboardController dashboardController =

65
Instantiator.getDashboardControllerInstance(userId);

// Open the dashboard window


FXMLLoader fxmlLoader = new
FXMLLoader(Application.class.getResource("dashboard.fxml"));
fxmlLoader.setController(dashboardController);
Parent root = fxmlLoader.load();

Stage registerStage = new Stage();


registerStage.initModality(Modality.APPLICATION_MODAL);
registerStage.initStyle(StageStyle.UTILITY);
registerStage.setTitle("Dashboard");
registerStage.setScene(new Scene(root));
registerStage.show();

// Close the current window


Stage currentStage = (Stage) noteTextArea.getScene().getWindow();
currentStage.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

66
1.1.3 DAO
ExpenseDao
package org.bekoder.expensetracker.dao;

import org.bekoder.expensetracker.dao.entites.Expense;

import java.sql.*;
import java.util.ArrayList;
import java.util.List;

public class ExpenseDAO {


private final Connection connection;

public ExpenseDAO(Connection connection) {


this.connection = connection;
}

public void addExpense(Expense expense) throws SQLException {


String sql = "INSERT INTO Expense (userId, date, type, category, amount, note)
VALUES (?, ?, ?, ?, ?, ?)";
try (PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setInt(1, expense.getUserId());
statement.setDate(2, new java.sql.Date(expense.getDate().getTime())); // Conversion
to SQL date
statement.setString(3, expense.getType());
statement.setString(4, expense.getCategory());
statement.setDouble(5, expense.getAmount());
statement.setString(6, expense.getNote());
statement.executeUpdate();
}
}

public List<Expense> getExpensesByMonthAndYear(int userId, int month, int year)


throws SQLException {
List<Expense> expenses = new ArrayList<>();
String sql = "SELECT * FROM Expense WHERE userId = ? AND MONTH(date) = ?
AND YEAR(date) = ?";
try (PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setInt(1, userId);
statement.setInt(2, month);
statement.setInt(3, year);
ResultSet resultSet = statement.executeQuery();

while (resultSet.next()) {
Expense expense = new Expense(
resultSet.getInt("id"),
resultSet.getInt("userId"),
resultSet.getDate("date"),
resultSet.getString("type"),
resultSet.getString("category"),
resultSet.getDouble("amount"),

67
resultSet.getString("note")
);
expenses.add(expense);
}
}
return expenses;
}

//Find total income by user id, month and year


public double getTotalIncomeByMonthAndYear(int userId, int month, int year) throws
SQLException {
double totalIncome = 0;
String sql = "SELECT SUM(amount) FROM Expense WHERE userId = ? AND
MONTH(date) = ? AND YEAR(date) = ? AND type = 'Income'";
try (PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setInt(1, userId);
statement.setInt(2, month);
statement.setInt(3, year);
ResultSet resultSet = statement.executeQuery();

while (resultSet.next()) {
totalIncome = resultSet.getDouble("SUM(amount)");
}
}
return totalIncome;
}

// Find total expense by user id, month and year


public double getTotalExpenseByMonthAndYear(int userId, int month, int year) throws
SQLException {
double totalExpense = 0;
String sql = "SELECT SUM(amount) FROM Expense WHERE userId = ? AND
MONTH(date) = ? AND YEAR(date) = ? AND type = 'Expense'";
try (PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setInt(1, userId);
statement.setInt(2, month);
statement.setInt(3, year);
ResultSet resultSet = statement.executeQuery();

while (resultSet.next()) {
totalExpense = resultSet.getDouble("SUM(amount)");
}
}
return totalExpense;
}
}

UserDao
package org.bekoder.expensetracker.dao;

68
import java.sql.*;

public class UserDAO {


private Connection connection;

public UserDAO(Connection connection) {


this.connection = connection;
}

public void addUser(String username, String password) throws SQLException {


String sql = "INSERT INTO User (username, password) VALUES (?, ?)";
try (PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setString(1, username);
statement.setString(2, password);
statement.executeUpdate();
}
}

public boolean checkLogin(String username, String password) throws SQLException {


String sql = "SELECT * FROM User WHERE username = ? AND password = ?";
try (PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setString(1, username);
statement.setString(2, password);
ResultSet resultSet = statement.executeQuery();
return resultSet.next(); // Returns true if a record is found
}
}

public int getUserId(String username, String password) throws SQLException {


String sql = "SELECT id FROM User WHERE username = ? AND password = ?";
try (PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setString(1, username);
statement.setString(2, password);
ResultSet resultSet = statement.executeQuery();
if (resultSet.next()) {
return resultSet.getInt("id");
} else {
return -1;
}
}
}

public boolean isUsernameExists(String username) throws SQLException {


String sql = "SELECT id FROM User WHERE username = ?";
try (PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setString(1, username);
ResultSet resultSet = statement.executeQuery();
return resultSet.next(); // Returns true if username exists
}
}

69
Main Class File: Application
package org.bekoder.expensetracker;

import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.bekoder.expensetracker.bootstrap.Instantiator;

import java.io.IOException;

public class Application extends javafx.application.Application {


@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new
FXMLLoader(Application.class.getResource("login.fxml"));
fxmlLoader.setController(Instantiator.loginController);
Scene scene = new Scene(fxmlLoader.load());
stage.setScene(scene);
stage.initStyle(StageStyle.UTILITY);
stage.setResizable(false);
stage.show();
}

public static void main(String[] args) {


launch();
}
}

70
2. SCREENSHOT

Login Screen

71
Invalid Login with Error Message

72
Registration Page

73
Dashboard (Empty)

74
Dashboard with Data

75
Add Expense Window

76
12. CONCLUSION AND FUTURE SCOPE
Conclusion
The Expense Tracker project has successfully demonstrated key aspects of
software development. This application effectively integrates essential
functionalities of expense tracking and budget management within a
straightforward user interface. Notable achievements of this project include the
hands-on experience in coding, interface design, and basic database integration.
The project's journey from initial concept to functional software has provided a
practical understanding of the software development lifecycle. Addressing
challenges in coding, debugging, and user experience design reflects the
project's successful implementation within its educational context.
Future Scope
Looking ahead, the Expense Tracker offers numerous opportunities for
enhancement and further development:
1. Feature Expansion:
• Introduce more detailed categorization of expenses and visual
analytics for a comprehensive financial overview.
2. Enhanced User Interface:
• Improve the interface design to make it more engaging and user-
friendly, utilizing advanced features of JavaFX.
3. Data Storage Enhancements:
• Upgrade data storage solutions, potentially moving from simple
file-based systems to more sophisticated database management.
4. Incorporation of Security Measures:
• Implement fundamental security features, such as password
encryption, to ensure user data protection.
5. Code Refinement:
• Focus on optimizing and refactoring the codebase for better
efficiency and maintainability.
6. Gathering and Implementing User Feedback:
• Collect feedback from users to refine the application, enhancing its
functionality and user experience.
7. Exploration of Mobile Platforms:
77
• Consider adapting the application for mobile platforms,
introducing elements of mobile app development.
8. Continuous Learning and Development:
• Use the project as a platform for ongoing educational development,
exploring new technologies, programming techniques, and best
practices in software engineering.

78
13. REFERENCE
For the Expense Tracker project, the references and resources utilized include a
combination of technical documentation, educational materials, and software
development tools. Here's a list of key references:
1. Java Documentation: Official documentation provided by Oracle for
Java programming language, offering comprehensive guides and
reference materials for Java development.
• Link: Java Documentation
2. JavaFX Documentation: Official resource for JavaFX, providing
detailed information on building user interfaces with JavaFX.
• Link: JavaFX Documentation
3. MySQL Documentation: The official documentation for MySQL
database management system, useful for understanding database
integration and SQL queries.
• Link: MySQL Documentation
4. IntelliJ IDEA Documentation: Comprehensive guide and reference for
IntelliJ IDEA, the chosen Integrated Development Environment (IDE) for
the project.
• Link: IntelliJ IDEA Documentation
5. Apache Maven Documentation: Official documentation for Apache
Maven, providing insights into project build and dependency
management.
• Link: Apache Maven Documentation
6. Git Documentation: Reference material for using Git, a version control
system essential for managing the project’s codebase.
• Link: Git Documentation
7. Stack Overflow and Developer Forums: Community-driven question-
and-answer websites that provide practical solutions and advice from the
global developer community.
• Link: Stack Overflow
8. Online Programming Tutorials and Courses: Various online platforms
offering tutorials and courses on Java, JavaFX, MySQL, and other
relevant technologies.

79
9. Software Development Textbooks and eBooks: Educational materials
covering fundamental and advanced concepts in software development,
programming languages, and database management.
These references have been instrumental in guiding the development of the
Expense Tracker project, offering both theoretical knowledge and practical
guidance.

80

You might also like