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 charAtindex and length method from the String class, toUpperCasechor
toLowerCasech isLetterch 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 Sch C ch P ch S
o Check whether the character is between A to Zch A && ch Z
Copy&Paste your code and screenshot your console output for the same Sample Runs shown above.
Please note the following Rubrics:
Requirement Points
Declaring variables and Scanner
Getting input through Scanner
Loop statement to iterate each character
Selection statements check each character
Use of methods from the String or Character class
Output is formatted as assigned
Output covers all test cases
Comments are present and descriptive, Proper submission PDF file
Total points:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
