Hi.
I am a new bie in programming.
The answer for my question may look very simple to you.
This my current code.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
The requirement is , when i run this program giving the string "abcd"(excluding quotes). the program should give me the output as
"there is only one vowel in the string you entered and that is a"
Please suggest me the required changes that are to be made to the code.
Thanks
I am a new bie in programming.
The answer for my question may look very simple to you.
This my current code.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
import java.lang.String;
import java.io.*;
import java.util.*;
public class CountVowels {
public static void main(String args[]) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the String:");
String text = bf.readLine();
int count = 0;
char c='a';
for (int i = 0; i < text.length(); i++) {
c = text.charAt(i);
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
count++;
}
}
if (count == 1)
System.out.println("there is only one vowel in the string you entered and that is --------");
else
System.out.println("There are" + " " + count + " " + "vowels");
}
}------------------------------------------------------------------------------------------------------------------------------------
The requirement is , when i run this program giving the string "abcd"(excluding quotes). the program should give me the output as
"there is only one vowel in the string you entered and that is a"
Please suggest me the required changes that are to be made to the code.
Thanks

Help
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Back to top










