Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago