Question: Ask the user to enter a string. Print how many different vowels there are in the string (e.g. aaaee has 2 different vowels). Ignore case,

Ask the user to enter a string. Print how many different vowels there are in the string (e.g. "aaaee" has 2 different vowels). Ignore case, i.e. 'A' and 'a' are considered to be the same vowel. 'y' is not considered a vowel. Look at the examples of output below and match them. Example: When the user enters the string: "It's Owl Stretching Time" the program should say that there are 3 different vowels in the string. DO NOT USE LOOPS. 

Hint

You could solve this problem by using a method of String that allows you to decide whether a certain String (say "e") appears in another String (say "It's Owl Stretching Time"). All methods of String can be found in the API.

Examples

% java CountVowels enter a string: Ask the user to enter a string.

there are 5 different vowels in string: "Ask the user to enter a string."

% java CountVowels enter a string: Print how many different vowels

there there are 4 different vowels in string: "Print how many different vowels there"

% java CountVowels enter a string: are in the string (e.g. "aaaee" has 2 different vowels).

there are 4 different vowels in string: "are in the string (e.g. "aaaee" has 2 different vowels)."

% java CountVowels enter a string: 123456

there are no vowels in string: "123456"

% java CountVowels enter a string: xxxxxAccccc

there is one vowel in string: "xxxxxAccccc"

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!