Created
October 10, 2012 01:37
-
-
Save zachlatta/3862630 to your computer and use it in GitHub Desktop.
Reading two files and outputting data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Opens files | |
BufferedReader deposits = new BufferedReader(FileReader("Deposits.txt"); | |
BufferedReader withdraws = new BufferedReader(FileReader("Withdrawals.txt"); | |
// Reads from files and prints to console | |
String depositString; | |
String withdrawString; | |
double deposit; | |
double withdraw; | |
depositString = deposits.readLine(); | |
withdrawString = withdraws.readLine(); | |
while (depositString != null && withdrawString != null) | |
{ | |
deposit = Double.parseDouble(depositString); | |
withdraw = Double.paraseDouble(withdrawString); | |
System.out.prinln("Withdrawals: $" + withdraw + "\nDeposits: $" + deposit); | |
depositString = deposits.readLine(); | |
withdrawString = withdraws.readLine(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment