wap to accept any string or sentence.change all the vowels by its next vowel and consonants by its next consonants and all other characters will remain as it is
Answers
Explanation:
import java.util.*;
public class Coder_Rishav
{
public static void main()
{
Scanner in = new Scanner(System.in);
System.out.println("Enter a String - ");
String n = in.nextLine();
String St = "";
char h = ' ';
char h1 = ' ';
int kp = 0;
int kp2 = 0;
String l="";
String l1 = "";
for(int k = 0;k < n.length();k++)
{
if (n.charAt(k) == 'a' ||n.charAt(k) == 'A' ||n.charAt(k) == 'e' ||n.charAt(k) == 'E' ||n.charAt(k) == 'i' ||n.charAt(k) == 'I' ||n.charAt(k) == 'o' ||n.charAt(k) == 'O' ||n.charAt(k) == 'u' ||n.charAt(k) == 'U' )
{
kp = (int)n.charAt(k) + 1;
kp2 = (int)n.charAt(k+1) + 1;
k ++;
h = (char)kp;
h1 = (char) kp2;
l = Character.toString(h);
l1 = Character.toString(h1);
St = St + l + l1;
}
else
{
St = St + n.charAt(k);
}
System.out.println("Answer - "+St);
}
}
Explain - first we take a string and in other varible we are add by char so if the character is a vovel then we convet it in ASCII form add and convet in char again then char to string and we will go one more step from loop so that the next will not check again :)
Plz follow me and thanks me :) and mark as brainliest.