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
Makovka662 [10]
3 years ago
5

Write a static method named fixSpacing that accepts a Scanner representing a file as a parameter and writes that file's text to

the console, with multiple spaces or tabs reduced to single spaces between words that appear on the same line.

Engineering
1 answer:
Umnica [9.8K]3 years ago
8 0

Answer:

See the code and explanation below

Explanation:

Is neccesary that accepts a Scan  representing a file as a parameter and writes that file's text on the language, and we need to reduce the multiple spaces to single spaces between  words that appear using just one line. Each word is to appear on the same line  in output as it appears in the file. We need to consider that the lines can be blank.

The code on Jave is this one:

public void DavidSpaces(Scan sc) {

   while(sc.hasNextLine()) {

       String line = sc.nextLine();

       Scanner linesc = new Scan(line);

       while(linesc.hasNext())

           System.out.print(linesc.next() + " ");

       System.out.println();

   }

}

The algorithm scheme is given on the picture attached.

You might be interested in
Explain the difference between thermoplastics and thermosets giving structure property correlation.
Misha Larkins [42]

Answer:

Explanation:

Thermosetting polymers are infusible and insoluble polymers. The reason for such behavior is that the chains of these materials form a three-dimensional spatial network, intertwining with strong equivalent bonds. The structure thus formed is a conglomerate of interwoven chains giving the appearance and functioning as a macromolecule, which as the temperature rises, simply the chains are more compacted, making the polymer more resistant to the point where it degrades.

Macromolecules are molecules that have a high molecular mass, formed by a large number of atoms. Generally they can be described as the repetition of one or a few minimum units or monomers, forming the polymers. In contrast, a thermoplastic is a material that at relatively high temperatures, becomes deformable or flexible, melts when heated and hardens in a glass transition state when it cools sufficiently. Most thermoplastics are high molecular weight polymers, which have associated chains through weak Van der Waals forces (polyethylene); strong dipole-dipole and hydrogen bond interactions, or even stacked aromatic rings (polystyrene). Thermoplastic polymers differ from thermosetting polymers or thermofixes in that after heating and molding they can overheat and form other objects.

Thermosetting plastics have some advantageous properties over thermoplastics. For example, better resistance to impact, solvents, gas permeation and extreme temperatures. Among the disadvantages are, generally, the difficulty of processing, the need for curing, the brittle nature of the material (fragile) and the lack of reinforcement when subjected to tension. But even so in many ways it surpasses the thermoplastic.

The physical properties of thermoplastics gradually change if they are melted and molded several times (thermal history), these properties are generally diminished by weakening the bonds. The most commonly used are polyethylene (PE), polypropylene (PP), polybutylene (PB), polystyrene (PS), polymethylmethacrylate (PMMA), polyvinylchloride (PVC), ethylene polyterephthalate (PET), Teflon (or polytetrafluoroethylene, PTFE) and nylon (a type of polyamide).

They differ from thermosets or thermofixes (bakelite, vulcanized rubber) in that the latter do not melt when raised at high temperatures, but burn, making it impossible to reshape them.

Many of the known thermoplastics can be the result of the sum of several polymers, such as vinyl, which is a mixture of polyethylene and polypropylene.

When they are cooled, starting from the liquid state and depending on the temperatures to which they are exposed during the solidification process (increase or decrease), solid crystalline or non-crystalline structures may be formed.

This type of polymer is characterized by its structure. It is formed by hydrocarbon chains, like most polymers, and specifically we find linear or branched chains

4 0
3 years ago
Provide an argument justifying the following claim: The average (as defined here) of two Java ints i and j is representable as a
ahrayia [7]

Answer:

public static int average(int j, int k) {

return (int)(( (long)(i) + (long)(j) ) /2 );

}

Explanation:

The above code returns the average of two integer variables

Line 1 of the code declares a method along with 2 variables

Method declared: average of integer data type

Variables: j and k of type integer, respectively

Line 2 calculates the average of the two variables and returns the value of the average.

The first of two integers to average is j

The second of two integers to average is k

The last parameter ensures average using (j+k)/2

3 0
3 years ago
Drag the tiles to the boxes to form correct pairs. Identify the designations of the three employees in an automobile company fro
aniked [119]

Answer:

is the fare of our responsibility towards

7 0
3 years ago
8. When supplying heated air for a building, one often chooses to mix in some fresh outside air with air that has been heated fr
Afina-wow [57]

Answer:

Check the explanation

Explanation:

Kindly check the attached images below to see the step by step explanation to the question above.

5 0
3 years ago
Rope BCA passes through a pulley at point C and supports a crate at point A. Rope segment CD supports the pulley and is attached
djverab [1.8K]

Answer:

363 pounds 32 degrees

Explanation:

Express your answers numerically in pounds and degrees to three significant figures separated by a comma. slader

6 0
3 years ago
Other questions:
  • A rotating cup viscometer has an inner cylinder diameter of 2.00 in., and the gap between cups is 0.2 in. The inner cylinder len
    9·1 answer
  • Convection is a function of temperature to the fourth power. a)-True b)-False
    9·1 answer
  • At the grocery store you place a pumpkin with a mass of 12.5 lb on the produce spring scale. The spring in the scale operates su
    5·1 answer
  • The news media often report an earthquake's magnitude on the Richter scale. Which of the following items are characteristics of
    14·1 answer
  • Traffic at a roundabout moves
    8·1 answer
  • What ic engine for mechanic
    15·1 answer
  • Describe in your own words the three strengthening mechanisms
    7·1 answer
  • This is various straps secured on a worker to distribute the fall arrest forces. What is depicted in the image?
    6·2 answers
  • Which of the following describes a tropical grassland environment?
    6·2 answers
  • An agricultural manager requires
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!