Question: ou are to design a program that prompts the user to enter a String and displays the number of vowels, consonants, and spaces contained in

ou are to design a program that prompts the user to enter a String and displays the number of vowels, consonants,
and spaces contained in the String entered. Assume letters A, E, I, O, U (or a, e, i, o, u) as the vowels. Check the two
sample runs and carefully read the instructions below for details.
Two Sample Run:
Instructions:
Prompt the user to input a String (the String may contain spaces).
Based on the inputted String, check each character using a Loop to count the total number of vowels,
consonants, and spaces.
Print the total number of vowels, consonants, and spaces. The count displayed must account for all the vowels
and consonants in the String regardless of case (upper or lower).
Print double quotes in the beginning and end of the output as shown in the Sample Run.
Hint:
o charAt(index) and length() method from the String class, toUpperCase(ch)(or
toLowerCase(ch)), isLetter(ch) method from the Character class might be helpful.
o Check whether the character is a space. (ch =='')
o Check whether the character is C or P or S.(ch =='C'|| ch =='P'|| ch =='S')
o Check whether the character is between A to Z.(ch >='A' && ch <='Z')
Copy&Paste your code and screenshot your console output for the same 2 Sample Runs shown above.
Please note the following Rubrics:
Requirement Points
Declaring variables and Scanner 10
Getting input through Scanner 10
Loop statement to iterate each character 20
Selection statements check each character 20
Use of methods from the String or Character class 10
Output is formatted as assigned 10
Output covers all 2 test cases 10
Comments are present and descriptive, Proper submission (PDF file)10
Total points: 100

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 Finance Questions!