counting letters java
6-20) (Count the letters in a string ) Write a method that counts the number of letters in astring using the following header:
public static int countLetters(String s)
Write a test program that prompts the user to enter a string and displays the number of letters in the string , not counting numbers, spaces, or symbols.
SAMPLE RUN #1
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java LetterCount
Enter a string of letter, numbers, spaces, and symbols: Jogging 10,000 miles is probably not good.
The number of letters in the string is: 29
SAMPLE RUN #2
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java LetterCount
Enter a string of letter, numbers, spaces, and symbols: When C02 builds up the TEMP goes up!
The number of letters in the string is: 26
SAMPLE RUN #3
— Prompts For Keyboard/Console/Standard Input —
string of letter, numbers, spaces, and symbols:
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
string of letter, numbers, spaces, and symbols:The number of letters in the
string is: 51
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java LetterCount
Enter a
string of letter, numbers, spaces, and symbols:
500 miles is a popular walking metric for love songs, or so they say.
The number of letters in the
string is: 51
SAMPLE RUN #4
— Prompts For Keyboard/Console/Standard Input —
string of letter, numbers, spaces, and symbols:
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
string of letter, numbers, spaces, and symbols:The number of letters in the
string is: 31
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java LetterCount
Enter a
string of letter, numbers, spaces, and symbols:
CAPS lowercase both count !@#$%^&*( 1234567890 should not.
The number of letters in the
string is: 31
compile with NetBeans
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


