1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lukranit [14]
3 years ago
12

Your program will be a line editor. A line editor is an editor where all operations are performed by entering commands at the co

mmand line. Commands include displaying lines, inserting text, editing lines, cutting and pasting text, 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:
Engineering
1 answer:
soldier1979 [14.2K]3 years ago
7 0

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);

}

}

You might be interested in
Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, print "To
weqwewe [10]

Answer:

#include <iostream>

using namespace std;

void PrintPopcornTime(int bagOunces) {

if(bagOunces < 3){

 cout << "Too small";

 cout << endl;

}

else if(bagOunces > 10){

 cout << "Too large";

 cout << endl;

}

else{

 cout << (6 * bagOunces) << " seconds" << endl;

}

}

int main() {

  PrintPopcornTime(7);

  return 0;

}

Explanation:

Using C++ to write the program. In line 1 we define the header "#include <iostream>"  that defines the standard input/output stream objects. In line 2 "using namespace std" gives me the ability to use classes or functions, From lines 5 to 17 we define the function "PrintPopcornTime(), with int parameter bagOunces" Line 19 we can then call the function using 7 as the argument "PrintPopcornTime(7);" to get the expected output.

8 0
3 years ago
1. Consider a city of 10 square kilometers. A macro cellular system design divides the city up into square cells of 1 square kil
kakasveta [241]

Answer:

a) n = 1000\,users, b)\Delta t_{min} = \frac{1}{30}\,h, \Delta t_{max} = \frac{\sqrt{2} }{30}\,h, \Delta t_{mean} = \frac{1 + \sqrt{2} }{60}\,h, c) n = 10000000\,users, \Delta t_{min} = \frac{1}{3000}\,h, \Delta t_{max} = \frac{\sqrt{2} }{3000}\,h, \Delta t_{mean} = \frac{1 + \sqrt{2} }{6000}\,h

Explanation:

a) The total number of users that can be accomodated in the system is:

n = \frac{10\,km^{2}}{1\,\frac{km^{2}}{cell} }\cdot (100\,\frac{users}{cell} )

n = 1000\,users

b) The length of the side of each cell is:

l = \sqrt{1\,km^{2}}

l = 1\,km

Minimum time for traversing a cell is:

\Delta t_{min} = \frac{l}{v}

\Delta t_{min} = \frac{1\,km}{30\,\frac{km}{h} }

\Delta t_{min} = \frac{1}{30}\,h

The maximum time for traversing a cell is:

\Delta t_{max} = \frac{\sqrt{2}\cdot l }{v}

\Delta t_{max} = \frac{\sqrt{2} }{30}\,h

The approximate time is giving by the average of minimum and maximum times:

\Delta t_{mean} = \frac{1+\sqrt{2} }{2}\cdot\frac{l}{v}

\Delta t_{mean} = \frac{1 + \sqrt{2} }{60}\,h

c) The total number of users that can be accomodated in the system is:

n = \frac{10\times 10^{6}\,m^{2}}{100\,m^{2}}\cdot (100\,\frac{users}{cell} )

n = 10000000\,users

The length of each side of the cell is:

l = \sqrt{100\,m^{2}}

l = 10\,m

Minimum time for traversing a cell is:

\Delta t_{min} = \frac{l}{v}

\Delta t_{min} = \frac{0.01\,km}{30\,\frac{km}{h} }

\Delta t_{min} = \frac{1}{3000}\,h

The maximum time for traversing a cell is:

\Delta t_{max} = \frac{\sqrt{2}\cdot l }{v}

\Delta t_{max} = \frac{\sqrt{2} }{3000}\,h

The approximate time is giving by the average of minimum and maximum times:

\Delta t_{mean} = \frac{1+\sqrt{2} }{2}\cdot\frac{l}{v}

\Delta t_{mean} = \frac{1 + \sqrt{2} }{6000}\,h

8 0
3 years ago
The local atmospheric pressure is measured with a water barometer. If the water column is measured to be 30 ft, what is the atmo
ella [17]

Answer:

The atmospheric pressure in atm=0.885 atm

Explanation:

Given that

Local pressure (h)= 30 ft of water height     ( 1 ft= 0.3048 m)

We know that pressure in given by

  P=ρgh

We know that ρ of water is 1000\dfrac{kg}{m^3}

So pressure

P=1000(9.81)(9.144)

P=89.7026 \dfrac{N}{m^2}

We know that 1000 Pa=0.00986 atm

So P=0.885 atm

The atmospheric pressure in atm=0.885 atm

8 0
3 years ago
Considering the analogy between electrical circuit and thermal circuit, show your approach to derive an expression for the therm
Simora [160]

Answer:

Thermal resistance for a wall depends on the material, the thickness of the wall and the cross-section area.

Explanation:

Current flow and heat flow are very similar when we are talking about 1-dimensional energy transfer. Attached you can see a picture we can use to describe the heat flow between the ends of the wall. First of all, a temperature difference is required to flow heat from one side to the other, just like voltage is required for current flow.  You can also see that R_{th} represents the thermal resistance. The next image explains more about the parameters which define the value of the thermal resistances which are the following:

  1. Wall Thickness.  More thickness, more thermal resistance.
  2. Material thermal conductivity (unique value for each material). More conductivity, less thermal resistance.
  3. Cross-section Area. More cross-section area, less thermal resistance.

A expression to define  the thermal resistance for the wall is as follows:  R_{th} =\frac{l}{Ak}, where  l is the distance between the tow sides of the wall, that is to say the wall thickness; A is the cross-section area and k is the material conducitivity.

5 0
3 years ago
Multiple Choice
Charra [1.4K]

Answer:

I guess A number is right

7 0
2 years ago
Other questions:
  • A 400-m^3 storage tank is being constructed to hold LNG, liquefied natural gas, which may be assumed to be essentially pure meth
    8·1 answer
  • Oil with a density of 800 kg/m3 is pumped from a pressure of 0.6 bar to a pressure of 1.4 bar, and the outlet is 3 m above the i
    9·1 answer
  • Which one of the following statements about the Wright brothers is not true?
    6·1 answer
  • A piston cylinder assembly fitted with a slowly rotating paddle wheel contains 0.13 kg of air at 300K. The air undergoes a const
    10·1 answer
  • Se requiere un permiso aprobación o restricción contaminante para todos los métodos comerciales de descarga de aguas residuales
    13·1 answer
  • What was the purpose of the vasa ship
    11·1 answer
  • Which of the following sentences uses the word malleable correctly?
    7·2 answers
  • Give three examples of how engineering has made human life better in your opinion.
    13·1 answer
  • An electrical current of 700 A flows through a stainlesssteel cable having a diameter of 5 mm and an electricalresistance of 610
    15·1 answer
  • Is reinforcement needed in a retaining wall
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!