Question
Create a file called CountLetters.java. Inside your code, define a variable of type String called sentence, and set it equal to an English sentence of
Create a file called CountLetters.java. Inside your code, define a variable of type String called sentence, and set it equal to an English sentence of your choosing. Write code that counts the number of vowels (a, e, i, o, u) and consonants (all other letters) in your sentence. Always count the letter "y" as a consonant. Your code will be graded on whether it [10] : Compiles and runs. [1] : Uses a for-loop to cycle through all characters in the sentence. [2p] : Correctly counts the vowels and consonants, whether they are lower or upper case. [10] : Outputs the results to standard output using complete sentences. HINTS: - A String is enclosed in quotes. Example: String 9 = "What day is it?"; - A char is enclosed in sin
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started