Question: Write a program that prompts the user to enter a string (a sentence) and count the number of words in the sentence. If the
Write a program that prompts the user to enter a string (a sentence) and count the number of words in the sentence. If the user enters an empty String, report an error message and ask for a non-empty String. Sample input javac NoWords.java java NoWords Sample output Enter a sentence: My Name is Ali Number of Words: 4
Step by Step Solution
3.41 Rating (157 Votes )
There are 3 Steps involved in it
The image youve provided describes a programming task where you need to create a program in Java that prompts the user to enter a sentence and counts ... View full answer
Get step-by-step solutions from verified subject matter experts
