Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions problems/minibudget/SPEC-v1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PROJECT: minibudget
OVERVIEW: A command-line income and expense tracker.
COMMANDS: init, add, list.
6 changes: 6 additions & 0 deletions problems/minibudget/SPEC-v2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PROJECT: minibudget
OVERVIEW: A command-line income and expense tracker.
COMMANDS: init, add, list.
ERROR HANDLING: If amount is negative, print "Error: Amount must be positive."
NEW COMMAND: delete <id> - Removes a transaction by its ID.
ERROR HANDLING: If ID does not exist during delete, print "Error: Transaction not found."
4 changes: 4 additions & 0 deletions problems/minibudget/problem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "minibudget",
"author": "Deniz Yucel Uzunay"
}
23 changes: 23 additions & 0 deletions problems/minibudget/test-v1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Test V1 Specifications for minibudget

# Clean up before testing
rm -rf .minibudget

# Test initialization
python3 minibudget.py init

# Test adding transactions
python3 minibudget.py add INCOME 5000 "Salary"
python3 minibudget.py add EXPENSE 150 "Groceries"

# Test listing transactions
OUTPUT=$(python3 minibudget.py list)

if [[ "$OUTPUT" == *"Salary"* ]] && [[ "$OUTPUT" == *"Groceries"* ]]; then
echo "V1 Tests Passed successfully."
exit 0
else
echo "V1 Tests Failed."
exit 1
fi
23 changes: 23 additions & 0 deletions problems/minibudget/test-v2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Test V1 Specifications for minibudget

# Clean up before testing
rm -rf .minibudget

# Test initialization
python3 minibudget.py init

# Test adding transactions
python3 minibudget.py add INCOME 5000 "Salary"
python3 minibudget.py add EXPENSE 150 "Groceries"

# Test listing transactions
OUTPUT=$(python3 minibudget.py list)

if [[ "$OUTPUT" == *"Salary"* ]] && [[ "$OUTPUT" == *"Groceries"* ]]; then
echo "V1 Tests Passed successfully."
exit 0
else
echo "V1 Tests Failed."
exit 1
fi
68 changes: 68 additions & 0 deletions spec.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
PROJECT: mini-budget
AUTHOR: Deniz Yücel Uzunay (251478081)
VERSION: v1
DATE: 2026-03-16

========================================
OVERVIEW
========================================

mini-budget is a command-line income and expense tracker.
It stores financial transactions in a plain text file and supports
adding, listing, checking balance, and deleting transactions.

All data is persisted in a directory called .minibudget/
in the current working directory.

========================================
COMMANDS
========================================

--- init ---
Usage: python minibudget.py init
Creates a .minibudget/ directory and an empty transactions.dat file.
If .minibudget/ already exists, print "Already initialized" and exit.

--- add ---
Usage: python minibudget.py add <TYPE> <amount> "<description>"
TYPE must be either INCOME or EXPENSE.
Appends a new transaction to transactions.dat.
Each transaction has: id (auto-increment), type, amount, description, created_date.
Prints "Added transaction #<id>: <TYPE> <amount>"

--- list ---
Usage: python minibudget.py list
Prints all transactions, one per line:
[1] [INCOME] 5000 - Salary (2026-03-16)
[2] [EXPENSE] 150 - Groceries (2026-03-16)
If no transactions exist, prints "No transactions found."

--- balance ---
Usage: python minibudget.py balance
Calculates the total balance (Total INCOME - Total EXPENSE).
Prints "Current Balance: <amount>"

--- delete ---
Usage: python minibudget.py delete 1
Removes transaction #1 from transactions.dat.
Prints "Deleted transaction #1."
If transaction does not exist, prints "Transaction #1 not found."

========================================
DATA FORMAT
========================================

File: .minibudget/transactions.dat
Format: One transaction per line, fields separated by |
Example:
1|INCOME|5000|Salary|2026-03-16
2|EXPENSE|150|Groceries|2026-03-16

========================================
ERROR HANDLING
========================================

- Running any command before "init": print "Not initialized. Run: python minibudget.py init"
- Invalid command: print "Unknown command: <command>"
- Missing arguments: print "Usage: python minibudget.py <command> [args]"
- Negative amount: If <amount> is less than 0, print "Error: Amount must be positive."