Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

=+5. How can you show them their personal benefits?

Answered: 1 week ago