Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a simple line editor. Keep the entire text in an ArrayList object, one line in a separate index position. Start the program with entering

Write a simple line editor. Keep the entire text in an ArrayList object, one line in a separate index position. Start the program with entering EDIT file, after which a prompt appears along with the line number. If the letter I is entered with a number n following it, then insert the text to be followed on line n. If I is not followed by a number, then insert the text on the current line. If D is entered with two numbers n and m, one n, or no number following it, then delete lines n through m, line et, or the current line. Do the same with the command L, which stands for listing lines. If A is entered, then append the text to the existing lines. Entry E signifies exit and saving the text in a file.

Here is an example:

Class name: File Edirt.java

Input file: textin. Txt

Content of text txt

The first line:

And another line

Output File: textin.txt

The first line

The second line

One more line

And another line

EDIT testfile 1> The first line 2> 3> And another line 4> I 3 3> The second line 4> One more line 5> L 1> The first line 2> 3> The second line 4> One more line 5> And another line. 5> D 2 4> L 1> The first line 2> The second line. 3> One more line 4> And another line 5> E //This is now line 5, not 3; // line 5, since I was issued from line 5; // line 4, since one line was deleted; //this and the following line was deleted; // now have new number;

Step by Step Solution

3.32 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

import javaioBufferedReader import javaioFile import javaioFileReader import javaioIOException impor... 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

Computer Networking A Top-Down Approach

Authors: James F. Kurose, Keith W. Ross

5th edition

136079679, 978-0136079675

Students also viewed these Programming questions

Question

Why are you interested in our program?

Answered: 1 week ago

Question

Describe how the RTS threshold works.

Answered: 1 week ago

Question

1. Research is asking questions and finding answers.

Answered: 1 week ago