Computer Science, asked by Lisa183, 1 year ago

write a program to accept any word and print its piglatin form


kappa: what's piglatin ?? OwO

Answers

Answered by KimChinkyo
3

public class piglatin
{
public static void main (String str)
{
int x,y;
String str1,str2;
char b;b=0;
x=str.lenght ();
System.out.println("The pig latin form of the given string ");
for (y=0;y <x;y++)
{
b=(str.charAt (y));
if (b=='a'||b=='e'||b=='i'||b=='o'||b=='u') [pls note you needa type the uppercase letters too o'er here]
break;
}
str1=str.substring (y,x)
str2=str.substring (0,y)
System.out.println (str1+str2+"ay");
}
}
Answered by sou7474
0

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