Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

file io

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I am having a problem figuring exactly what I need to do on this problem. I want to read in a file, place it in an array. After that it needs to be sent to a class that calculates the charge. The second part is supposed to output the results to another file(txt). I think I have the first part down. What I am wondering is how does one instantiate an object array, place the results into the appropiate array and then take that and print to a text file???Here is the code I have so far, any help will keep me from freakin' out...

[ December 14, 2002: Message edited by: mike hengst ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I think you need a Printwriter in the try and catch block to print the results to the .txt files
for Example
{
try{
PrintWriter out = new PrintWriter(new FileWriter(outFile.txt));
All you codes goes here.
}catch(IOException e)
{
}
out.flush();
out.close();
System.out.println("finished");
}
 
mike hengst
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Thanks,Viet
I have been working on this all afternoon and I have changed my code to inlcude the PrintWriter stuff. i just don't think I am doing it right. Here is my ammended code. Maybe you or someone else can see what I am doing wrong, or not doing at all.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Continued here.
 
    Bookmark Topic Watch Topic
  • New Topic