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
Step: 1
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started