Computer Science, asked by pradipta33, 1 year ago

Write a program in java to print a piglatin word

Answers

Answered by Bhoomicharu
4
Writing a Java program that converts an English word into PigLatin [closed] I have to write a program that converts an English word to Pig Latin. Pig latin in this case is basically put "ay" at the end after finding the vowel. The programs prints out the input converted to lowercase pig latin and the input reversed.

Bhoomicharu: only trying it !!
Answered by sou7474
10

class propereasypiglatin

{

   static void accept(String S)

   {

       String S1=S.trim();

       String s=S1.toUpperCase();

       char t=s.charAt(0);

       if(t=='A'||t=='E'||t=='I'||t=='O'||t=='U')

       {

        String s1=s.substring(1);

        String s2=s.substring(0,1);

        String s3="WAY";

        String f1=s1+s2+s3;

        System.out.println(f1);

       }

       else

       {

        String s4=s.substring(1);

        String s5=s.substring(0,1);

        String s6="AY";

        String f2=s4+s5+s6;

        System.out.println(f2);

       }

   }

}

Similar questions