Question
: Write a Java program (called Lab7Exercise2) to read a sentence (as a single string) from the user, the program then prints out the entered
: Write a Java program (called Lab7Exercise2) to read a sentence (as a single string) from the user, the program then prints out the entered sentence. Then utilize loops to print out the sentence one word per line using the space (blank) character as the delimiter. (Your program should be able to handle instances of multiple spaces between words and the possibility that there are spaces at the beginning and end of the sentence.) Use proper labels and line up the outputs as shown in the examples below. Design your program to allow the user to re-run the program with a different input. Entered String: This is a test input, and can be a longer string too. Please no arrays. Thank you.
Word #1: This
Word #2: is
Word #3: a
Word #4: test
Word #5: input,
Word #6: and
Word #7: can
Word #8: be
Word #9: a
Word #10: longer
Word #11: string
Word #12: too.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started