For some reason my program is overwriting the file and not adding it.
This is the method that I am using to create and name files:
Public Zero Filename Method (IOException) {System.out.println (" File name input "); InputStreamReader isr = New InputStreamReader (System.in); Buffed reader br = new buffed reader (ISR); Filename = br.readLine (); RF = new RandomAccessFile (filename, "RW"); }
I am using this method to take input from a user, it sets the value to a variable that is written in a file:
Public Zero Input Mode () throws IOException {InputStreamReader isr = new InputStreamReader (System.in); Buffed reader br = new buffed reader (ISR); System.out.println ("Input carnet, id, current mileage, gas cost, number of days, rate, total fee, discount, tax, net charge and return mills"); String token string; TokenString = br.readLine (); String Toner String; St = new stringctonizer (token string); Name = st.nextToken (); Id = integer.center (st.nextToken ()); Existing mileage = integrated .Presscent (St. NX) Gascoast = Integer .Portset (St. NX) Ndays = integer Paracet (St. Nouvell Token ()); Rate = integer PRIIENT (St. NX) (KNET); Total Charge = Integer Persicent (st. Nxtikon ()); Discount = Integer .Portcent (St. NX) Tax = integer .Prescent (St. NX) NetCharge = integer. PRISIN (St. NX) (cn.); ReturnMileage = integer.percent (st.nextToken ()); }
Then I am using this method to write to a file:
public zero file configuration method IOException {raf.writeInt (id ); Raf.writeInt (existingMileage); Raf.writeInt (gasCost); Raf.writeInt (Ndays); Raf.writeInt (rate); Raf.writeInt (totalCharge); Raf.writeInt (discount); Raf.writeInt (tax); Raf.writeInt (netCharge); Raf.writeInt (returnMileage); Raf.writeBytes (Operation + "\ r \ n"); // close the stream raf.close (); }
I do not understand why this is happening, can someone help me?
Relevant.
Comments
Post a Comment