// The "DTfiveint" class.
import java.io.*;
public class DTfiveint
{
public static void main (String[] args) throws IOException
{
BufferedReader five = new BufferedReader (new FileReader ("five.txt"));
int multiply[] = new int [5];
for (int i = 0 ; i < multiply.length ; i++)
{
multiply [i] = Integer.parseInt (five.readLine ());
}
int x = calc1 (multiply);
System.out.println (x);
int y = calc2 (multiply);
System.out.println (y);
} // main method
public static int calc1 (int multiply[])
{
int doub = 0;
for (int i = 0 ; i < 5 ; i++)
{
doub = multiply [i] * 2;
}
return doub;
}
public static int calc2 (int multiply[])
{
int triple = 0;
for (int i = 0 ; i < 5 ; i++)
{
triple = multiply [i] * 3;
}
return triple;
}
} // DTfiveint class
this does compile but it doesn't run
when i press run this pops up:
FileNotFoundException: five.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at DTfiveint.main(DTfiveint.java:7)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)