College

We appreciate your visit to Your program will be a line editor A line editor is an editor where all operations are performed by entering commands at the command line. This page offers clear insights and highlights the essential aspects of the topic. Our goal is to provide a helpful and engaging learning experience. Explore the content and find the answers you need!

Your program will be a line editor. A line editor is an editor where all operations are performed by entering commands at the command line. Commands include displaying lines, inserting text, editing lines, cutting and pasting text, and loading and saving files. For example, a session where the user enters three lines of text and saves them as a new file may appear as:

Answer :

Answer:

Java program given below

Explanation:

import java.util.*;

import java.io.*;


public class Lineeditor

{

private static Node head;

class Node

{

int data;

Node next;

public Node()

{data = 0; next = null;}

public Node(int x, Node n)

{data = x; next =n;}

}

public void Displaylist(Node q)

{if (q != null)

{

System.out.println(q.data);

Displaylist(q.next);

}

}

public void Buildlist()

{Node q = new Node(0,null);

head = q;

String oneLine;

try{BufferedReader indata = new

BufferedReader(new InputStreamReader(System.in)); // read data from terminals

System.out.println("Please enter a command or a line of text: ");

oneLine = indata.readLine(); // always need the following two lines to read data

head.data = Integer.parseInt(oneLine);

for (int i=1; i<=head.data; i++)

{System.out.println("Please enter another command or a new line of text:");

oneLine = indata.readLine();

int num = Integer.parseInt(oneLine);

Node p = new Node(num,null);

q.next = p;

q = p;}

}catch(Exception e)

{ System.out.println("Error --" + e.toString());}

}


public static void main(String[] args)

{Lineeditor mylist = new Lineeditor();

mylist.Buildlist();

mylist.Displaylist(head);

}

}

Thanks for taking the time to read Your program will be a line editor A line editor is an editor where all operations are performed by entering commands at the command line. We hope the insights shared have been valuable and enhanced your understanding of the topic. Don�t hesitate to browse our website for more informative and engaging content!

Rewritten by : Barada