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

Igpay Atinlay. Write a program that prints Walt Savitch\'s name in \"Pig Latin\"

ID: 3649008 • Letter: I

Question

Igpay Atinlay. Write a program that prints Walt Savitch's name in "Pig Latin". The program starts with the string variable first set to his first name and the string variable last set to his last name. Both names should be all lower-case. Your program should then create a new string that contains his full name in pig latin with the first letter capitalized for the first and last name. Use only the pig latin rule of moving the first letter to the end of the word and adding 'ay'. Output the pig latin name to the screen. Use the substring and toUpperCase methods to construct the new name.


INPUT and PROMPTS. None.

OUTPUT. The output should be Savitch's full name (first then last) turned into Pig Latin and in the following format:
Walt Savitch turned into Pig Latin is:
first-name-in-Pig-Latin last-name-in-Pig-Latin

CLASS NAMES. Your program class should be called IgpayAtinlay

Explanation / Answer

Here's a Java program that just converts Walt Savitch's name into Pig Latin. Hope this helps! :) Let me know if you have any questions or need any clarification! public class IgpayAtinlay { public static void main(String[] args) { String firstName = "walt"; String lastName = "savitch"; String firstLetterFirstName = firstName.substring(0,1); String firstLetterLastName = lastName.substring(0,1); String capCharacterFirstName = firstName.substring(1,2).toUpperCase(); String capCharacterLastName = lastName.substring(1,2).toUpperCase(); String lastLettersFirstName = firstName.substring(2); String lastLettersLastName = lastName.substring(2); String pigLatinFirst = capCharacterFirstName + lastLettersFirstName + firstLetterFirstName; String pigLatinLast = capCharacterLastName + lastLettersLastName + firstLetterLastName; String ay = "ay"; System.out.println("Walt Savitch turned into Pig Latin is: " + pigLatinFirst + ay + " " + pigLatinLast + ay); } }