Question: Java Based Programming. Create an application class called Text with the following tasks for its main method: static void main(String[] args) - Asks for a

Java Based Programming.

Create an application class called Text with the following tasks for its main method: static void main(String[] args) - Asks for a sentence and stores it in a string object. Then creates a StringBuilder object to store that string.

- Removes any blank spaces after and before the input text.

- Removes any extra blank spaces between the words in the input text.

- Counts the number of words in the input text.

- Shows the trimmed text and the number of words.

Note: You should use trim, indexOf, charAt, and deleteCharAt methods.

Sample Output

Java Based Programming. Create an application class called Text with the following

Enter a text: Characters are the fundamental building blocks of Java source programs Trimmed Text: Characters are the fundamental building blocks of Java source programs. Word Count10

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!