Question: Write/Read the file 4A.Write to file Write the code to do the following: -Display message to ask then read input from the keyboard about the

Write/Read the file

4A.Write to file

Write the code to do the following:

-Display message to ask then read input from the keyboardabout the following information:

* accountNumber (string)

* customerName (string)

* balance (float)


-open output filecustomer.txt to write:

-Write to the output file customer.txt the following information that have read input from the keyboard in the following format:

accountNumber - customerName - balance


For example:

1561163623- Luis Martinez - 2845.25

-close file


4B - Read from the file

Open notepad, type the following lines with the file name as data.txt

1112243433 - Mary Lane - 1250.366

2123312344 - John Smith - 2134.25

1561175753 - James Smith - 1255.25


-provide the Java code to open file data.txtto read

-Use the loop to read file

-Read each line of the file then display on screen

-continue reading and displaying on the screen all the lines until end of the file

-Write: "End of the file data.txt" on the screen

-close data.txt file


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the Java code with explanations for both writing to a file and reading from a file 4A Writing to a file customertxt Java import javautilScanneri... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!