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
What issues does society try to forget in order to not have to deal with them ?
velikii [3]

Answer: Homelessness, Drug addiction, Mental Illness, Climate change.

Explanation:

Society would rather be ignorant to/ ignore all of these realities so they do not have to stop specific behaviors or actually acknowledge other people and help. Sometimes people are so stressed out about their own lives, they can not bare another persons issues. People are ignorant to climate change because correcting it requires massive changes and society is selfish and unwilling to change.

6 0
3 years ago
Discuss the differences between conduction and convective heat transfer.
FrozenT [24]

Answer:

Basically there are two principal differences between the convection and conduction heat transfer

Explanation:

The conduction heat transfer is referred to the transfer between two solids due a temperature difference, while for, the convective heat transfer is referred to the transfer between a fluid (liquid or gas) and a solid. Also, they used different coefficients for its calculation.

We can include on the explanation that conduction thermal transfer is due to temperature difference, while convection thermal transfer is due to density difference.

8 0
3 years ago
In almost all cases, touching power lines or coming into contact with energized sources will result in what?
Fynjy0 [20]

Answer:

electrocution

Explanation:

You will end up getting shoked because the electricity is attracted to the water in your body.

6 0
3 years ago
Carl why is there a dead man in the living room?
scoray [572]
You always need some company
3 0
3 years ago
I really need help ASAP!!!
ValentinkaMS [17]

Explanation:

He would work on the thing like in the method you work on your question.

8 0
3 years ago
Other questions:
  • Linear Time Invariant Systems For each of the systems below an input x(t) and the output y(t) are plotted. Determine whether eac
    5·1 answer
  • Air expands through an ideal turbine from 1 MPa, 900 K to 0.1 MPa, 500K. The inlet velocity is small compared to the exit veloci
    10·1 answer
  • If the resistance reading on a DMM'S meter face is to 22.5 ohms in the range selector switch is set to R X 100 range, what is th
    5·1 answer
  • In a semiconductor manufacturing process, three wafers from a lot are tested. Each wafer is classified as pass or fail. Assume t
    15·1 answer
  • When you learned about the Highway Transportation system you learned about 6 different types of people as
    10·1 answer
  • Selling a new vehicle pays a salesperson $1500. Selling a used vehicle pays a commission of 5% of the selling price. Write an in
    9·1 answer
  • HELP PLS
    7·1 answer
  • How many color are in da rainbow​
    5·2 answers
  • If the driver gear has 5 teeth and the driven gear has 10 teeth,what is the gear ratio?​
    13·2 answers
  • "Transformer is used to change the voltage".
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!