Hi,
I'm currently having a problem with my code... I am trying to output to a file numerous transactions that have took place.
if (userInput == 1) { System.out.println("The current account balance is: £" + accountBalance + "0" + "\n"); System.out.println("Please enter the amount you would like to transfer"); transferOut = console.nextDouble(); while (transferOut > accountBalance) { System.out.println("The maximum amount you can transfer is: £" + accountBalance + "0"); System.out.println("Please enter another amount."); transferOut = console.nextDouble(); } accountBalance = accountBalance - transferOut; transactionNumber = transactionNumber + 1; System.out.println("The remaining balance in your account is: £" + accountBalance + "0"); Date date = new Date(); outFile.println("Transaction Number " + transactionNumber + " took place on" + " " + date + " " + "with £" + transferOut + "0" + " being transferred out of the account."); PrintWriter updateBalance = new PrintWriter("shop-account.txt"); updateBalance.println(accountBalance); updateBalance.close(); outFile.close(); }
The 'outFile' is the output file described above. Any help/guidance would be greatly appreciated.
Regards
iCurtisIT