Description: You will need to write a program that allows the user to enter a string of text. Next, loop through and keep a counter of how many separate words are in that string. Once counting is complete, display the total number of words back to the user.
You will need to create a method like this:
public static int numberOfWords(String sentence)
Parameters: String sentence -> the input from the user
Return: the numberOfWords
Below is the input and the output we expect from your program. This is to help you know if you are on the right track.
Example input: Cows go moo.
Example output: Enter a String: [String] Total Words: 3