You may use Scanner class to capture the values from a text file....
private static final getSamples() throws Exception{
ArrayList<Object> list = new ArrayList<Object>();
Scanner read = new Scanner(new File("samples.txt"));
while(read.hasNext())
list.add(read.next());
read.close();
return list;
}
You can test the code....
For calculations, same as my first example, take a loop from the returned list
After every calculation, show also the answer directly....
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Last edited by sukatoa : 05-18-2008 at 06:31 PM.
|