diff --git a/problems/minibudget/SPEC-v1.txt b/problems/minibudget/SPEC-v1.txt new file mode 100644 index 00000000..12ed8b99 --- /dev/null +++ b/problems/minibudget/SPEC-v1.txt @@ -0,0 +1,3 @@ +PROJECT: minibudget +OVERVIEW: A command-line income and expense tracker. +COMMANDS: init, add, list. diff --git a/problems/minibudget/SPEC-v2.txt b/problems/minibudget/SPEC-v2.txt new file mode 100644 index 00000000..3dfd8e61 --- /dev/null +++ b/problems/minibudget/SPEC-v2.txt @@ -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 - Removes a transaction by its ID. +ERROR HANDLING: If ID does not exist during delete, print "Error: Transaction not found." diff --git a/problems/minibudget/problem.json b/problems/minibudget/problem.json new file mode 100644 index 00000000..f4cfe927 --- /dev/null +++ b/problems/minibudget/problem.json @@ -0,0 +1,4 @@ +{ + "name": "minibudget", + "author": "Deniz Yucel Uzunay" +} diff --git a/problems/minibudget/test-v1.sh b/problems/minibudget/test-v1.sh new file mode 100644 index 00000000..136084a4 --- /dev/null +++ b/problems/minibudget/test-v1.sh @@ -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 diff --git a/problems/minibudget/test-v2.sh b/problems/minibudget/test-v2.sh new file mode 100644 index 00000000..136084a4 --- /dev/null +++ b/problems/minibudget/test-v2.sh @@ -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 diff --git a/spec.txt b/spec.txt new file mode 100644 index 00000000..08dbf4e2 --- /dev/null +++ b/spec.txt @@ -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 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 #: " + +--- 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: " + +--- 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: " +- Missing arguments: print "Usage: python minibudget.py [args]" +- Negative amount: If is less than 0, print "Error: Amount must be positive." \ No newline at end of file