This is a simple console-based application for managing personal finances. It allows users to add transactions, view all transactions, view transactions within a specific period, and view transactions from a specific date.
- Add transaction: Allows the user to input a date (in DD.MM.YYYY format) and the amount spent for that transaction. This data is stored in a text file.
- Show transactions: Displays a history of all recorded transactions with their dates and amounts.
- Show transactions by period: Prompts the user for a start and end date (in DD.MM.YYYY format) and displays all transactions within that date range.
- Show transactions by date: Asks the user for a specific date (in DD.MM.YYYY format) and shows all transactions recorded on or after that date.
- Exit: Terminates the application.
- Save the provided Java code into the following directory structure:
Ensure you have the following files within this structure:
personalFinanceManager/src/ConsoleInterface.javaMain.javaTransactionReader.javaTransactionWriter.java
- Create a directory named
datainside thepersonalFinanceManagerdirectory:personalFinanceManager/data/ - Inside the
datadirectory, create an empty text file namedtransactions.txt:personalFinanceManager/data/transactions.txt - Compile the Java source files. Open a terminal or command prompt, navigate to the
personalFinanceManagerdirectory, and run the following command:javac src/*.java - Run the application from the
personalFinanceManager/srcdirectory:Alternatively, if your classpath is correctly configured, you might be able to run it from thejava personalFinanceManager.src.Main
personalFinanceManagerdirectory:java personalFinanceManager.src.ConsoleInterface
The project consists of the following Java classes:
ConsoleInterface.java: Handles the console-based user interface, displaying options and taking user input.Main.java: The entry point of the application, which creates and launches theConsoleInterface.TransactionReader.java: Responsible for reading transaction data from thetransactions.txtfile and displaying it based on different criteria (all, by period, by date).TransactionWriter.java: Handles writing new transaction data (date and amount) to thetransactions.txtfile.
This is a simple console-based application for managing personal finances. It allows users to add transactions, view all transactions, view transactions within a specific period, and view transactions from a specific date.
- Add transaction: Allows the user to input a date (in DD.MM.YYYY format) and the amount spent for that transaction. This data is stored in a text file.
- Show transactions: Displays a history of all recorded transactions with their dates and amounts.
- Show transactions by period: Prompts the user for a start and end date (in DD.MM.YYYY format) and displays all transactions within that date range.
- Show transactions by date: Asks the user for a specific date (in DD.MM.YYYY format) and shows all transactions recorded on or after that date.
- Exit: Terminates the application.
- Save the provided Java code into the following directory structure:
Ensure you have the following files within this structure:
personalFinanceManager/src/ConsoleInterface.javaMain.javaTransactionReader.javaTransactionWriter.java
- Create a directory named
datainside thepersonalFinanceManagerdirectory:personalFinanceManager/data/ - Inside the
datadirectory, create an empty text file namedtransactions.txt:personalFinanceManager/data/transactions.txt - Compile the Java source files. Open a terminal or command prompt, navigate to the
personalFinanceManagerdirectory, and run the following command:javac src/*.java - Run the application from the
personalFinanceManager/srcdirectory:Alternatively, if your classpath is correctly configured, you might be able to run it from thejava personalFinanceManager.src.Main
personalFinanceManagerdirectory:java personalFinanceManager.src.ConsoleInterface
The project consists of the following Java classes:
ConsoleInterface.java: Handles the console-based user interface, displaying options and taking user input.Main.java: The entry point of the application, which creates and launches theConsoleInterface.TransactionReader.java: Responsible for reading transaction data from thetransactions.txtfile and displaying it based on different criteria (all, by period, by date).TransactionWriter.java: Handles writing new transaction data (date and amount) to thetransactions.txtfile.
Transaction data is stored in a simple text file named transactions.txt located in the personalFinanceManager/data/ directory. Each transaction occupies two lines: the first line contains the date in the format date: DD.MM.YYYY, and the second line contains the amount spent in the format money: amount.
- The application relies on user input in the specified format (DD.MM.YYYY for dates). Incorrect input might lead to errors.
- The data is stored in a plain text file, which is suitable for simple use cases but might not be robust for handling large amounts of data or concurrent access.