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

A rancher in Texas drills for water on her property and in the process, hits oil which squirts strongly from the ground. Within days a system is installed to ca
WILL GIVE BRAINLIEST IF RIGHT AND WORTH 75 POINTSThe Environmental Club is holding round two of the clean-up competition. In this round, two-person teams are as
Analyze the following recursive method. public static long factorial(int n) { return n * factorial(n - 1); } A. Invoking factorial(0) returns 0. B. Invokin
what event interrupts the funeral of ezeudu's​
In stargirl what did Kevin think about stargirl?
How do you write 820.62% as a decimal
Carbon dioxide makes up approximately 0.04% of Earth's atmosphere. If you collect a 2.7 L sample from the atmosphere at sea level (1.00 atm) on a warm day (25 ∘
Anyoneeee has notes on calomel electrode????​
What type of medical facilty often has a variety of types of medical specialsts and may contain X
A factory produces 272 chairs in an 8-hour shift. If the factory produces the same number of chairs each hour, how many chairs does it produce in 30 minutes?