• Post Reply Bookmark Topic Watch Topic
  • New Topic

Binary Files ?

 
atif abbas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i need some ideas with Binary Files..
I have an assignment to do based on binary files..
basically, A binary file stores customer id, name and current balance in ascending order of customer id. A program accepts transactions from a user to update customer records. Later enters customer id, program reads file for a record matching with the customer id. entered. Then it asks for type of transaction - p(payment), s(sales). It asks for the amount from current balance.
Updated record is then written to a new file. Program continues until end of the file, and then displays each record from the new file. All transactions are entered in the order of customer id.
And the assignment only asks us to create 5 records, and the user enters three transactions, two for payment type and one for sales type.
i have some ideas on what input and output files to use. like FileOutputStream and FileInputStream.
But, how to update the file i dont know..
kind regards
Atif
 
Jacky Chow
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Atif,
I think you should not use FileOutputStream and FileInputStream. The easy way to do this is that use fix-size record, and then use the RandomAccessFile the to access records.
 
atif abbas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, for your tips..
one other thing how can i update records once io have stored records. Like if i want to add other records, and how will i be able to match the records based on the customer id..
kind regards
Atif
 
atif abbas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my code so far..please i need help with the updating of current-balance ..thanks
kind regards
Atif.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!