Question: The Problem Statement In this lab section, you are going to learn how to read data from keyboard and write the data to a disk

The Problem Statement

In this lab section, you are going to learn how to read data from keyboard and write the data to a disk file. You are going to write an application that has one class (simple enough). One requirement for this lab is to use the following classes: BufferedReader, InputStreamReader, System.in, FileWriter (cannot use Scanner class).

This application will display the following message in the DOS console:

Enter a line of text (stop to quit), then hit enter.)

:

prompting the user type a line of string. The program will keep offer column symbol : until the user typed stop. For each line typed, the program will write it to a disk file named myData.txt (make sure that each new line is stored as separate line). The disk should be automatically closed when the program exits.

Please follow the following sequence of steps to generate the content (Test Case 1).

Test Case 1

At the prompt type: the first line

At the prompt type: the second line

At the prompt type: this line contains 8, 9, 10

At the prompt type: stop

Go to the appropriate directory, find and open the myData.txt file.

The Directory that the FileWriter will Write File to

Sometime, a programmer (especially the ones new to Java) will wonder where the input file should be put or where the written file is created. In this lab, we used one file written method

FileWriter fw = new FileWriter("myData.txt").

You will be given the opportunity of finding out where the file will be located.

According to the information given above, draw a class diagram in the space below (using UML notation).

Answer:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!