In this program, user will enter a sentence and all the vowels, if present in the sentence will be converted into the next vowel. For example ‘I’ will be converted into ‘O’ and ‘i’ will be ‘e’. Similar effects will be on every vowels present in the sentence.
import java.io.*;
class Vowel
{
String name;
char arr[]={ 'a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U'};
int i,len, alen,j;
char ch;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public void take()throws Exception
{
System.out.println("Enter the sentence:");
name=br.readLine();
len=name.length();
alen=arr.length;
for(i=0;i< len;i++)
{
ch=name.charAt(i);
switch(ch)
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
for(j=0;j< alen;j++)
if(ch==arr[j])
break;
if(j< alen-2)
System.out.print(arr[j+2]);
else
{
j=j-(alen-2);
System.out.print(arr[j]);
}
break;
default:
System.out.print(ch);
}
}
}
public static void main(String args[]) throws Exception
{
Vowel ob=new Vowel();
ob.take();
}
}
Care has been taken to check if the vowel appears in the last pair of the array, in such case the vowel character from the beginning pair is to be displayed.
Sample Input: This is a vOwel Test
Sample output: Thos os e vUwel Tist
Sample Input:This IUu of teuo
Sample output: Thos OAa uf tiau
sir can you please give me the practical programs for isc from the year 2000 to 2009.At least the links.please
ReplyDeleteIn this site you will get ISC practical papers of several years. Search it.
ReplyDelete