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
Kamila [148]
3 years ago
9

Write a program that removes all spaces from the given input. You may assume that the input string will not exceed 50 characters

. Ex: If the input is: Hello my name is John. the output is: HellomynameisJohn. Your program must define and call the following function. userString is the user specified string. The function assigns userStringNoSpaces with the user specified string without spaces. void RemoveSpaces(char userString[], char userStringNoSpaces[]) Note: This is a lab based on a previous chapter that now requires the use of a function.

Engineering
2 answers:
GrogVix [38]3 years ago
5 0

Answer:

Program that removes all spaces from the given input

Explanation:

// An efficient Java program to remove all spaces  

// from a string  

class GFG  

{  

 

// Function to remove all spaces  

// from a given string  

static int removeSpaces(char []str)  

{  

   // To keep track of non-space character count  

   int count = 0;  

 

   // Traverse the given string.  

   // If current character  

   // is not space, then place  

   // it at index 'count++'  

   for (int i = 0; i<str.length; i++)  

       if (str[i] != ' ')  

           str[count++] = str[i]; // here count is  

                                   // incremented  

         

   return count;  

}  

 

// Driver code  

public static void main(String[] args)  

{  

   char str[] = "g eeks for ge eeks ".toCharArray();  

   int i = removeSpaces(str);  

   System.out.println(String.valueOf(str).subSequence(0, i));  

}  

}  

Law Incorporation [45]3 years ago
3 0

Answer:

Please see attachment

Explanation:

Please see attachment

You might be interested in
During the recovery of a cold-worked material, which of the following statement(s) is (are) true?
Len [333]

Answer:

Some of the internal strain energy is relieved.

There is some reduction in the number of dislocations.

The electrical conductivity is recovered to its precold-worked state.

The thermal conductivity is recovered to its precold-worked state

Explanation:

The process of the recovery of a cold-worked material happens at a very low temperature, this process involves the movement and annihilation of points where there are defects, also there is the annihilation and change in position of dislocation points which leads to forming of the subgrains and the subgrains boundaries such as tilt, twist low angle boundaries.

4 0
3 years ago
Define Mechanism and mechanics.​
aivan3 [116]

mechanism, in mechanical construction, the means employed to transmit and modify motion in a machine or any assemblage of mechanical parts.

6 0
3 years ago
Read 2 more answers
What is the objective of phasing out an INDUCTION MOTOR before putting the machine into commission?
enyata [817]

The main objective of phasing out an INDUCTION MOTOR is to identify the ends of the stator coils.

<h3>What is an induction motor?</h3>

An induction motor is a device based on alternate electricity (AC) which is composed of three different stator coils.

An induction motor is a device also known as an asynchronous motor due to its irregular velocity.

In conclusion, the objective of phasing out an INDUCTION MOTOR is to identify the ends of the stator coils.

Learn more on induction motors here:

brainly.com/question/15721280

#SPJ1

8 0
2 years ago
In a steady flow device, the properties of the system remains constant with time. a)True b) False
Leviafan [203]

Answer:

True

Explanation:

By definition of steady flow we have

\frac{\partial f(x,y,z,t) }{\partial t}=0

where f(x,y,z,t) is any property of the system under consideration

=> f(x,y,z,t) = constant

7 0
3 years ago
A 10 hp motor is used to raise a 1000 Newton weight at a vertical distance of 5 meters. What is the work the motor performs?
Aleksandr [31]

The work done by a 10 HP motor when it raises a 1000 Newton weight at a vertical distance of 5 meters is <u>5kJ</u>.

Define work. Explain the rate of doing work.

Work is <u>the energy that is moved to or from an item by applying force along a displacement</u> in physics. For a constant force acting in the same direction as the motion, work is <u>easiest expressed as the product of </u><u>force </u><u>magnitude and distance traveled</u>.

Since the <u>force </u><u>transfers one unit of energy for every unit of </u><u>work </u><u>it performs</u>, the rate at which work is done and energy is used are equal.

Solution Explained:

Given,

Weight = 1000N and distance = 5m

A/Q, the work here is done in lifting then

Work = (weight) × (distance moved)

         = 1000 X 5

         = 5000Nm or 5000J = 5kJ

Therefore, the work done in lifting a 1000 Newton weight at a vertical distance of 5 meters is 5kJ.

To learn more about work, use the link given
brainly.com/question/25573309
#SPJ9

<u />

4 0
1 year ago
Other questions:
  • Compare automation and autonomous
    12·1 answer
  • An atomic force that can attract or repel ferrous substances is<br> known as:
    14·1 answer
  • 1 2 3 4 5 6 7 8 9 10
    14·1 answer
  • A closed, rigid, 0.45 m^3 tank is filled with 12 kg of water. The initial pressure is p1 = 20 bar. The water is cooled until the
    15·1 answer
  • Its an opinion!!!!
    8·1 answer
  • Sam constructs a circuit, connects a lead acid battery of 2 V to a lamp of resistance 3 Ω and places an ammeter across it. What
    8·2 answers
  • Multiple Choice
    7·1 answer
  • Explain the use of a vacuum gauge.
    15·1 answer
  • 3. What type of tool do you use to make angles?
    15·1 answer
  • An open tank contain oil of specific gravity 0.75 on top of
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!