Text File

Part 1 – Text file practice:

Create a class called TextFileDriver. In the main method of this class, write a program that gives and takes advice on programming. The program starts by writing a piece of advice to the console window. It then asks the user to type in a different piece of advice. The program then ends.

The next person to run the program receives the advice given by the person who last ran the program. The advice is kept in a text file and the content of the file changes after each run of the program.

You should use a text editor (such as TextEdit or Notepad) to enter the initial piece of advice in the file. For this lab, you may assume that the advice entered by the user is no more than one line in length.

Sample output (showing two executions of the program)

My advice is: Write a program every day!

Enter your advice: Practice, practice, practice

 

My advice is: Practice, practice, practice

Enter your advice: Think before you type!

Leave a Reply

Your email address will not be published. Required fields are marked *