Computer Science Homework Solutions
Problem
#160196

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*****

Attached file(s):
Attachments
Figure 9-49.jpg  View File
Solution
What is this?
By OTA - Overall OTA Rating
Debraj Banerjee, MIT (IP) - 4.8/5
Purchase Cost Now
$2.19 CAD (was ~$7.98)
Included in Download
  • Plain text response
  • Attached file(s):
    • Keyboard.java
    • Count.java
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • How is the input and output processing structured in the C language? - Can you please help me answer the following study question? Thanks. How is the input and output processing structured in the C language? How can you display some combination of words and numbers on ...
  • Access - Wildcards: - Here's what Access says about searching for wildcards: When using wildcard characters to search for other wildcard characters such as an asterisk (*), question mark (?), number sign (#), openi ...
  • What is "in-line processing"? - What is "in-line processing"?
  • Write a program in C which tells if a sentence is a Palindrome or not. - A palindrome consists of a word or deblanked, unpunctuated phrase that is spelled exactly the same when the letters are reversed. Write a recursive function that returns a value of 1 if its string arg ...
  • Effect of Code in C - ***This is in C*** char Ch; while ((Ch=getchar()) !=';') putchar (Ch); Will this code: a. read and write characters until something other than a ; is read. b. read characters up to ...
Browse