Create a program that takes a word and transforms it to Pig Latin using String methods. You
Question:
Create a program that takes a word and transforms it to Pig Latin using String methods. You may need the word's length, a substring that does not include the first letter, and a substring that is just the first letter (you can get the ith letter of a string using substring(i,i+1) so for example the letter at index 3 would be substring(3,4)).
Use the substring method to transform a word into Pig Latin where the first letter is put at the end and "ay" is added. The word pig is igpay in Pig Latin.
public class PigLatin
{
public static void main(String[] args)
{
String word =
// Use word.substring to construct word in pig latin
String pigLatin =
System.out.println(word + " in Pig Latin is " + pigLatin);
}
}
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch