Question: Write a Java program that takes the input from the user for a string, named s, made of up to 5 words and then

Write a Java program that takes the input from the user for a string, named s, made of up to 5 words and then prints the number of words in s. For example, if s = "apple, orange, and peach", print "The string contains 4 words." to the console. If s = "MicrosoftOffice", your output would indicate there was only 1 word. For this assignment, you can assume that the only spaces in the string are between words. You must use IF statements to solve this problem. You may not use String methods like replace, replaceAll, or split. Please see the additional requirement below that lists allowed String methods. Create a project and class named HW4FirstnameLastname in NetBeans using your actual first and last names to hold your program. Activate Windows
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
