hamaXD

Lab 2 : 2 Aeiou

Feb 7th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public class Aeiou{
  2.     private int field_count;
  3.     private String field_word;
  4.  
  5.     public void setWord(String temp){
  6.         field_word = temp;
  7.     }
  8.  
  9.     public void countVowel(){
  10.         int index=0;
  11.         String word ="aeiou";
  12.         int loop=0;
  13.         while(loop<5){
  14.             while(index<field_word.length()){
  15.                 if((field_word.charAt(index))==(word.charAt(loop))){
  16.                     field_count+=1;
  17.                 }
  18.             index++;
  19.             }
  20.         index=0;
  21.         loop++;
  22.         }
  23.         System.out.println("Word : " + field_word+ " have aeiou : "+field_count);
  24.     }
  25. }
Add Comment
Please, Sign In to add comment