Share
Explore BrainMass

Using String Methods to Count Characters

****This needs to be written in Java*****

Generally, word processing programs can count and then display the number of characters in a document, either including or excluding blank characters. Using methods from the String class, write a program that will accept input from the keyboard and then display three values:

1) The count of all characters in the string, including leading and trailing blanks.

2) The count of characters not including leading and trailing blanks.

3) The count of all non-blank characters.

The program should continue as long as the user enters any values, even if only spaces are entered. Figure 9-49 (attached to post) displays sample output from the program.

****This needs to be written in Java*****

Attachments

Solution Summary

Generally, word processing programs can count and then display the number of characters in a document, either including or excluding blank characters. Using methods from the String class, write a program that will accept input from the keyboard and then display three values.

$2.19