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
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