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 is the focus of 7th grade civics
Jobisdone [24]
C. seems like the best answer. i may be wrong so don’t quote me on that
7 0
3 years ago
Read 2 more answers
Write a program that uses a function called Output_Array_Info. Output_Array_Info Properties: Input Parameters: 1. A pointer to a
Artyom0805 [142]

Answer:

C++ code explained below

Explanation:

Please note the below program has been tested on ubuntu 16.04 system and compiled using g++ compiler. This code will also work on other IDE's

-----------------------------------------------------------------------------------------------------------------------------------

Program:

-----------------------------------------------------------------------------------------------------------------------------------

//header files

#include<iostream>

//namespace

using namespace std;

//function defintion

void Output_Array_Info(int *array_ptr, int size)

{

//display all array elements

cout<<"Array elements are: "<<endl;

for(int i =0; i<size; i++)

{

cout<<*(array_ptr+i)<<endl;

}

//display address of each element

cout<<endl<<"memory address of each array elemnt is: "<<endl;

for(int i =0; i<size; i++)

{

cout<<array_ptr+i<<endl;

}

}

//start of main function

int main()

{

//pointer variables

int *pointer;

//an array

int numbers[] = { 5, 7, 9, 10, 12};

//pointer pointing to array

pointer = numbers;

//calculate the size of the array

int size = sizeof(numbers)/sizeof(int);

//call to function

Output_Array_Info(numbers, size);

return 0;

}

//end of the main program

8 0
2 years ago
Identify the phase of the design process illustrated in the following scenario, and justify its importance. Kristin has recently
zaharov [31]

Answer:

The design process is at the verify phase of Design for Six Sigma

Explanation:

In designing for Six Sigma, DFSS, is a product or process design methodology of which the goal is the detailed identification of the customer business needs by using measurements tools such as statistical data, and incorporating the identified need into the created product which in this case is the hydraulic robot Kristin Designed

Implementation of DFSS follows a number of stages that are based on the DMAIC (Define - Measure - Analyze - Improve) projects such as the DMADV which stand for define - measure - analyze - verify

Therefore, since Kristin is currently ensuring that the robot is working correctly and meeting the needs of her client the design process is at the verify phase.

5 0
3 years ago
Two different fuels are being considered for a 2.5 MW (net output) heat engine which can operate between the highest temperature
sveta [45]

Answer:

If the heat engine operates for one hour:

a) the fuel cost at Carnot efficiency for fuel 1 is $409.09 while fuel 2 is $421.88.

b) the fuel cost at 40% of Carnot efficiency for fuel 1 is $1022.73 while fuel 2 is $1054.68.

In both cases the total cost of using fuel 1 is minor, therefore it is recommended to use this fuel over fuel 2. The final observation is that fuel 1 is cheaper.

Explanation:

The Carnot efficiency is obtained as:

\epsilon_{car}=1-\frac{T_c}{T_H}

Where T_c is the atmospheric temperature and T_H is the maximum burn temperature.

For the case (B), the efficiency we will use is:

\epsilon_{b}=0.4\epsilon_{car}

The work done by the engine can be calculated as:

W=\epsilon Q=\epsilon H_v\cdot m_{fuel} where Hv is the heat value.

If the average net power of the engine is work over time, considering a net power of 2.5MW for 1 hour (3600s), we can calculate the mass of fuel used in each case.

m=\frac{P\cdot t}{\epsilon H_v}

If we want to calculate the total fuel cost, we only have to multiply the fuel mass with the cost per kilogram.

TC=m\cdot c

8 0
2 years ago
There are two machines for sale that you are considering purchasing for your sawmill to produce hardwood flooring. You want to f
devlian [24]

Answer:

Machine 2 has a higher process capability index, it would be best considered for purchase.

Explanation:

Process capability index: Cpk= Min [(mean-L spec)/3sd; (U spec-mean)/3sd]

For machine 1, mean= 48mm and L spec= 46 and U spec= 50, Standard deviation sd= 0.7

Cpk= [0.952;0.952]= 0.952

For machine 2, mean= 47 and L spec= 46 and U spec= 50, Standard deviation sd= 0.3

Cpk= [1.111;3.333]= 1.111

It is clearly observed from the calculations above that the Cpk value of machine 2 is higher than that of machine 1.

Since machine 2 has a higher process capability index, it would be best considered for purchase.

4 0
3 years ago
Other questions:
  • A soil had a liquid limit of 44, a plastic limit of 21, and a shrinkage limit of 14. In the summer, the in situ water content wa
    14·1 answer
  • A motor vehicle has a mass of 1.8 tonnes and its wheelbase is 3 m. The centre of gravity of the vehicle is situated in the centr
    14·1 answer
  • A hollow steel tube with an inside diameter of 100 mm must carry a tensile load of 400 kN. Determine the outside diameter of the
    12·2 answers
  • If you want to obtain a Class E license before you turn 18, you must______. A. be in compliance with school attendance requireme
    15·1 answer
  • A police officer in a patrol car parked in a 70 km/h speed zone observes a passing automobile traveling at a slow, constant spee
    6·1 answer
  • Let CFG G be the following grammar.
    7·2 answers
  • List and explain the major features that the following building designs must have to relate directly to their functions.
    11·1 answer
  • Marie and James are bubbling dry pure nitrogen (N2) through a tank of liquid water (H2O) containing ethane (C2H6). The vapor str
    5·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    7·1 answer
  • What is software certification? Discuss its importance in the changing scenario of software industry. ​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!