Question: Write a java program using the following instructions: You will write a program to count the number of vowels in a string. Write a method

Write a java program using the following instructions:

You will write a program to count the number of vowels in a string.

Write a method isVowel that receives a single character and returns true if it is a vowel :

public static boolean isVowel(char letter). 
Write a method countVowels that receives a string and uses the isVowel method to count and return the number of vowels in a string: 
public static int countVowels(String inputStr). 

Prompt for user to enter a string, then print the number of vowels:

Sample Output: (Bold is user input)

Enter a string and I will count the vowels: 
Christmas is coming soon! 
There are 7 vowels in this string 
Another one? y 
Enter a string and I will count the vowels: 
And then Happy New Year! 
There are 6 vowels in this string 
Another one? n 

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