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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!