immortalsoul7861
immortalsoul7861 immortalsoul7861
  • 06-04-2020
  • Computers and Technology
contestada

For this exercise, you are given a phrase. Return the number of time the word “dog” appears in the phrase.

Example:

countDog("dogs are good") --> 1
countDog("my dog does not like hot dogs") --> 2

This is in Java.

Respuesta :

rainestormee
rainestormee rainestormee
  • 19-04-2020

Answer:

Is in the provided screenshot!

Explanation:

Steps needed to solve this problem.

1) Split the input string into separate words

2) Filter the words to ones that match "dog"

3) Count how many words are left - as these are all the ones that say dog.

4) Return the value needed!

Ver imagen rainestormee
Answer Link

Otras preguntas

Which event sparked the outbreak of World War I? (1) attack on Pearl Harbor by Japan (2) Germany’s invasion of Poland (3) Bolshevik coup d’état in Russia (4) as
11,950,500,000,000 in scientific notation
The main difference between speed and velocity involves A. gravity. B. weight. C. distance. D. direction.
please help me with this
What is 25%of395 thanks
each rung of the DNA ladder is made of
Ho Chi Minh compared his military to a(n) a. wasp. b. tiger. c. snake. d. elephant
Which natural resource is a source of conflict in Central Asia and the Caucasus? a. Water b. Timber c. Gold d. Copper
From which country did Gothic architecture emerge in the mid-twelfth century? A. England B. France C. Germany D. Italy
During the 19th century, the United States ability to remain isolated from European affairs was largely due to its A. lack of cultural identity. B. economic ins