Question: PLEASE WRITE IN JAVA. Write a simple line editor. Keep the entire text in an ArrayListobject, one line in a separate index position. Start the
PLEASE WRITE IN JAVA.
Write a simple line editor. Keep the entire text in an ArrayListobject, one line in a separate index position. Start the program by entering the 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 online n. If letter 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 n, 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. Note: If you prefer, you can use a LinkedList object instead of ArrayList.
Sample of the input and output.
EDIT textin.txt
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 //This is now line 5, not 3;
5> D 2 // line 5, since L was issued from line 5;
4> L // line 4, since one line was deleted;
1>The first line
2>The second line //this and the following line was deleted;
3>One more line // now have new number;
4>And another line
5>E
program needs to utilize the following:
A: Appends or changes the selected line
D: Deletes selected line(s)
I: Inserts at the selected line(s)
L: Lists all current lines
E: Exits and Saves the file at original location
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
