Hello,
I am currently working on a program that calculates several things about a Banks savings account for my intro to java class.
The program is supposed to open the file named "Deposits.txt" that contains several numbers (double). The Code is currently in my USB as well as the txt file --> (E:\Bernal_Daniel_COP2250_U03_SPRING12\Projects\Pr oject5). i have Tried everything to make the file open but i get an error. I don't know whats going on.
This is what i have to open the file: (minus the rest of the code)
//Open the Deposits.txt file.
File f = new File("Deposits.txt");
Scanner inputFile = new Scanner (f);
// Get the deposits from the Deposits.txt file.
while (inputFile.hasNext())
{
double number = inputFile.nextDouble();
instance.deposit(number);
System.out.println("balance is : " + instance.getBalance()); //checks that method is adding the deposits/Another class
}
I have no Syntax errors in netbeans at all, this is my run window:
run:
Please Enter the Saving's Account Annual Interest Rate:
.065
Exception in thread "main" java.io.FileNotFoundException: Deposits.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.jav a:120)
at java.util.Scanner.<init>(Scanner.java:636)
at SavingsAccountTest2.main(SavingsAccountTest2.java: 43)
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)
This is how the course book tells us to open the file.
Any help would be extremely appreciated.
Thanks