Advertisement
heysoul_sisypus

Vowel Search (user input)

Jan 19th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. package javaapplication328;
  2. import java.util.*;
  3. /**
  4.  *
  5.  * @author Medina
  6.  */
  7. public class JavaApplication328 {
  8. //
  9.     //
  10.     public static void main(String[] args) {
  11.         Scanner scan = new Scanner (System.in);
  12.         System.out.print("Input character string: ");
  13.         String str = scan.next();
  14.         str=str.toLowerCase();
  15.         char c = ' ';
  16.         int vowel = 0;
  17.         for(int i=0;i<str.length();i++)
  18.         {c=str.charAt(i);
  19.         if (c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){vowel++;}
  20.         }
  21.         System.out.print("There are: "+vowel+" vowel/s");
  22.     }
  23.    
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement