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
Get step-by-step solutions from verified subject matter experts
