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

The Munich agreement was an arrangement in which the leaders of Great Britain, France, Italy, and Germany allowed Germany to annex the Sudetenland (territory of
What legal tools did the Roman Republic used to upload the rule of law
the most economical way to purchase large items, such as furniture, is to buy with?
The value of a scientific variable ____. A) can change B) cannot be measured C) always remains the same D) only can be found using math
Troubadours played an important role in the middle ages by
An impact of the post-World War II economic boom in Europe was increased standard of living emigration overseas school dropout rates women in the workforce
Diseases that don't last long are
The rise in military power in Japan was a direct result of
If your company has a lot of competitors, what does that do to your demand? A.Makes it less elastic B.Makes it more elastic C.Makes it less need-based D.Makes i
Celina has 4 glass ornaments blue Orange pink and purple. How many ways can she hang them in a row so that the blue and pink ornaments aren't touching