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!
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!
- Why do Businesses Exist Why does Starbucks Exist What Service does Starbucks Provide Really what is their product.
- The pattern of numbers below is an arithmetic sequence tex 14 24 34 44 54 ldots tex Which statement describes the recursive function used to..
- Morgan felt the need to streamline Edison Electric What changes did Morgan make.
Rewritten by : Barada