I'm having some trouble with this program. I'm new to the
java programming language so I don't know much. Can someone help me?
The instructions are: To process the transactions, you will need to read one line at a time from the transactions.txt file and parse the
String that you retrieve. You can use the Scanner class for this. The delimiter will be a colon. Then process the transaction; you do not need to check the type of transaction. Just add the amount of the transaction to the checkbook balance. Adding a negative transaction amount will decrease the balance as expected. Be sure to use try/catch blocks where appropriate.
After you have processed each transaction, call the animate method. This method belongs to the Accounting class, so you will call animate without using an object reference. The API if the animate method is the following
public void animate { String currentTransaction, double currentAmount, double currentBalance, }
As you can see, the animate method takes three arguments: currentTransaction is the transaction name ("Deposit," for example), currentAmount is the amount of the transaction (-45.00, for example), and currentBalance is the current balance of the checkbook. Assuming that you have a String variable called transactionName, a double variable called amount, and another double called balance, a call to animate will look like the following:
animate( transactionName, amount, balance);
When you call the animate, the window will display the current transaction geographically. It will also display the transaction amount (red, if negative, blue if positive), and the current checkbook balance (in black). By adding the previous checkbook balance to the current amount, you will be able to compute in your head what the current checkbook valance should be and determine if your program is working correctly.
When you reach the end of the file, print the final balance and write it to a file named balance.txt
So far, I have coded this much in the Accounting class:
Can someone please help?