• Post Reply Bookmark Topic Watch Topic
  • New Topic

I/o and streams: appending a source file and write to two new files.  RSS feed

 
Mitchell McKnight
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you guys Help me by telling me if you know where i can get an example so I can see how to write the code to get my work done. I don't want my work done for me. I just need examples that are in the ballpark.

Develop an application that reads product id, product name and product price from an input text file.

Example input product file:



1001 Rake 20.00

1002 Hose 15.00

1003 Lawnmower 200.00

1004 Drill 150.00



If the price of the item is greater than or equal to 50.00 write the product information to a text file called WishList.txt. If the price of the item is less than 50.00 write the product information to a text file called GiftIdeas.txt.



If your output file(s) already exist, you should append to the file and not overwrite it.


I would appreciate any help at all
Thank you
Mitchell
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by studying these code examples, particularly e35, e37 and e38: http://www.exampledepot.com/egs/java.io/pkg.html

For breaking a line into its constituent pieces, the StringTokenizer class is helpful. (This may go beyond the scope of the assignment, but you may want to think about product names that contain spaces - as opposed to the ones you mention above.)
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!