Writing to a file from the console

  • 7
  • unavailable
Now you need to write something to a file. You need to first read the file name from the console, then read lines entered by the user until the user enters "exit". Finally, write all the entered lines to the file, each on a new line.
You can't complete this task, because you're not signed in.
Comments(3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
MICHAEL DUNLAPLevel 19 , Bellevue
22 August, 05:17
Finally got it to pass. My condition for checking for "exit" had to go at the very bottom of the while loop to pass the 4th condition. Also, the 5th requirement is tricky. I wasn't passing it until I commented out the line that adds the name of the file as a line in the file. The requirement does state that ALL entered lines must be in the file-- would this not include the entered name of the file? Apparently not.
MICHAEL DUNLAPLevel 19 , Bellevue
22 August, 04:46
I'm stumped. It works fine in the Intellij, but I'm overlooking some case that needs to be addressed. Any hints? Many thanks.
ProfjLevel 20 , Lagos
19 June, 22:25
But seriously. I'm not sure I encountered a lesson that dealt with all these read and write into file stuff.