Saturday, July 12, 2014

JAVA PROGRAM TO FIND GIVEN CHARACTER IS VOWEL OR CONSONANT

import java.io.*;
class vowelconsonant
{
 public void process(char choice)
 {
     switch(choice)
      {
          case 'a':System.out.println("vowel");break;
          case 'e':System.out.println("vowel");break;
          case 'i':System.out.println("vowel");break;
          case 'o':System.out.println("vowel");break;
          case 'u':System.out.println("vowel");break;
          case 'A':System.out.println("vowel");break;
          case 'E':System.out.println("vowel");break;
          case 'I':System.out.println("vowel");break;
          case 'O':System.out.println("vowel");break;
          case 'U':System.out.println("vowel");break;    
          default:System.out.println("CONSONANT");
              
      } 
 }
}
public class vowel {
    public static void main(String args[]) throws IOException
    {
        InputStreamReader in=new InputStreamReader(System.in);
        BufferedReader br=new BufferedReader(in);
        System.out.println("enter a alphabetical character:");
        char choice=(char) br.read();
        
        vowelconsonant obj=new vowelconsonant();
        
        obj.process(choice);
      }
  }

No comments:

Post a Comment

Computer Network & Computer Features | Bal Varg | Computer Questions List!

  Computer Network & Computer Features 1) _______ is a thin strip like bar present at the bottom of the screen.   Taskbar 2) _______ ser...