Albeta Thomas
Albeta Thomas
FACULTY OF SCIENCE
ASSIGNMENT
COURSE LECTURER
JUNE, 2024.
1|Page
TABLE OF CONTENTS
CHAPTER 1................................................................................................................................3
1.0 ABSTRACT.......................................................................................................................3
1.2 INTRODUCTION............................................................................................................3
1.3 PREFERENCES...............................................................................................................3
CHAPTER 2................................................................................................................................4
2.0 MAIN PROJECT STRUCTURE.......................................................................................4
2.1 MAIN SYSTEM BUILDING ON A JAVA IDE VIEW (PYCHAM)................................4
2.2 OUTPUT...........................................................................................................................6
2.3 FEATURES......................................................................................................................6
2.4 How it is run.......................................................................................................................6
2.5 PSEODECODE FOR THE PROGRAM........................................................................6
2.6 ALGORITHM..................................................................................................................8
2.7 FLOWCHART FOR THE PROGRAM.........................................................................8
CHAPTER 3...............................................................................................................................9
3.0 SUMMARY......................................................................................................................9
3.1 Here is a summary that includes the stack data structure:...........................................9
3.1.1 FUNCTIONAL REQUIREMENTS.............................................................................9
4.0 NON-FUNCTIONAL REQUIREMENTS......................................................................9
5.0 ADDITIONAL CONSIDERATIONS.............................................................................9
6.0 CONCLUSION...............................................................................................................10
6.1 Key Takeaways:..............................................................................................................10
6.2 Future Enhancements:...................................................................................................10
CHAPTER 5..............................................................................................................................11
7.0 REFERENCES...............................................................................................................11
2|Page
CHAPTER 1
1.0 ABSTRACT
This project develops a personal finance management system using Python. The system
allows users to add expenses and income, view transactions, calculate totals, and check
budget status. The project aims to provide a simple and effective tool for individuals to
1.2 INTRODUCTION
crucial for achieving financial stability and growth, our (Personal Finance Management
providing an intuitive and efficient way to track income, manage expenses, and adhere
to budgets.
Using a stack-based data structure, this system offers a robust approach to handling
revert the most recent changes, reflecting real-life scenarios where recent financial
1.3 PREFERENCES
3|Page
CHAPTER 2
class Stack:
def __init__(self):
self.items = []
self.items.append(item)
def pop(self):
def is_empty(self):
return len(self.items) == 0
def peek(self):
def validate_date(date_string):
try:
datetime.strptime(date_string, '%Y-%m-%d')
return True
except ValueError:
4|Page
return False
def calculate_total(stack):
total = 0
total += item['amount']
return total
def main():
expenses_stack = Stack()
income_stack = Stack()
while True:
print("8. Exit")
if choice == '1':
5|Page
if validate_date(date):
else:
if validate_date(date):
else:
if expenses_stack.is_empty():
else:
print("\nAll Expenses:")
print(
6|Page
{item['description']}, Date: {item['date']}")
if income_stack.is_empty():
else:
print("\nAll Income:")
print(
total_expenses = calculate_total(expenses_stack)
total_income = calculate_total(income_stack)
total_income = calculate_total(income_stack)
total_expenses = calculate_total(expenses_stack)
else:
7|Page
elif choice == '8':
break
else:
if __name__ == "__main__":
main()
2.2 OUTPUT
2.3 FEATURES
8|Page
2.5 PSEODECODE FOR THE PROGRAM
expenses_stack = Stack()
income_stack = Stack()
function validate_date(date_string):
try:
datetime.strptime(date_string, '%Y-%m-%d')
return True
except ValueError:
return False
function calculate_total(stack):
total = 0
total += item['amount']
return total
function main():
while True:
if validate_date(date):
9|Page
stack.push(user_input)
else:
if stack.is_empty():
else:
print("\nAll Records:")
print(item)
total = calculate_total(stack)
print(f"\nTotal: ${total}")
total_income = calculate_total(income_stack)
total_expenses = calculate_total(expenses_stack)
10 | P a g e
break
else:
2.6 ALGORITHM
1. Initialize two stacks, expenses stack and income stack, to store expense and income
records, respectively.
2. Define a function, validate date, to check if a date string is in the correct format
(YYYY-MM-DD).
11 | P a g e
2.7 FLOWCHART FOR THE PROGRAM
CHAPTER 3
3.0 SUMMARY
View Expenses (pop and display all expenses from the stack)
View Income (pop and display all incomes from the stack)
View Budget Status (compare total income and expenses from the stack)
12 | P a g e
Exit Program (exit program safely)
4. Data Structure (Stack data structure for storing expenses and incomes)
By using a stack data structure, the system can efficiently store and manage expenses
and incomes, and provide accurate calculations for total expenses, income, and budget
status.
13 | P a g e
CHAPTER 4
6.0 CONCLUSION
stack data structure for managing personal finances. By leveraging stacks, the system
provides a robust and simple method for users to track their expenses and income in a
1. Effective Use of Stacks: The stack data structure is ideal for managing the
addition and removal of financial records, ensuring that the most recent entries
efficient.
transactions, and the system calculates total expenses and income, helping users
between sessions.
2. Extended Functionality: Add features like undoing recent entries (using stack's
This project showcases the practical application of the stack data structure in a real-
world context, highlighting its utility in managing dynamic financial data effectively. It
14 | P a g e
provides a foundation for further development into a more sophisticated personal
CHAPTER 5
7.0 REFERENCES
Book:
-Key Topics: Stacks, queues, linked lists, trees, sorting, searching, and algorithm
design.
Online Resources:
2. -"Problem Solving with Algorithms and Data Structures using Python" by Bradley N.
and their implementations in Python. The book includes examples, visualizations, and
exercises.
(https://runestone.academy/runestone/books/published/pythonds/index.html)
-Key Topics: Basic data structures (including stacks), recursion, algorithm efficiency,
structures-and-algorithms-in-python/)
4. Github.com
6. An AI assistance
16 | P a g e