Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone please help with this JAVA code. Thank you Question 2: Pig Latin (60

ID: 641678 • Letter: C

Question

Can someone please help with this JAVA code. Thank you

Question 2: Pig Latin (60 points) Pig Latin is a language game, in which regular English words are changed and obfuscated according a number of simple rules, so that the resulting text becomes hard to understand. An example of a sentence in Pig Latin is y, ouyay illway itewray omesay odecay Invay isthay artpay ofway ethay assignmentwa atthay anslatestray Englishway intoway Igpay Atinlay which translates into In this part of the assignment, you will write some code that translates English into Pig Latin Here are the rules to translate an English word into Pig Latin. First, if the word starts with one or more consonants, the consonant (s) are moved to the end of the word. So, "pig" becomes "igp", and "this" becomes "isth". If the word starts with a vowel, a w' is added to the end of the word, so "assignment" becomes "assignmentw" Then, the suffix "ay" is added to the result of the first step. So "pig" becomes "igpay", "this" becomes "isthway", and "assignment becomes "assignmentway"

Explanation / Answer

import java.io.*;

class pigLatinfy

{

public static void main(String args[])throws Exception

{

String s,s1=" ",temp;

char c;

int i,j,k=0;

System.out.println("Enter the English sentence:");

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

s=br.readLine();

s+=" ";

j=s.length();

for(i=0;i

{

c=s.charAt(i);

if(c=='a' | c=='e' | c=='i' | c=='o' | c=='u')

{

temp=s.substring(k,i);

k=s.indexOf(" ",i);

s1+=s.substring(i,k)+temp+"ay";

i=k;

k++;

}

}

System.out.println("Pig Latin form for the sentence:"+s1);

}

}