Question Index

Write a program to convert given English sentence to Pig Latin. To convert to Pig Latin move the first letter to the end and add 'ay' to it. In the word hence formed convert the first letter to upper case and all other letters to lower case.

Input (String) Output (String)
Pig Latin Rocks Igpay Atinlay Ocksray
How are you Owhay Reaay Ouyay
Tit for tat Ittay Orfay Attay
Broken pencils are pointless Rokenbay Encilspay Reaay Ointlesspay

class ConvertEnglishToPigLatin

{    public static void main(String s[])
        String inputSentence = "I stepped on a Cornflake, and now I am a cereal killer";
        System.out.println("The equivalent Pig Latin sentence is : " + convertToPigLatin(inputSentence));


public static String convertToPigLatin(String input) {
//Write code here to convert given sentence to Pig Latin.



Topic: Java Character Class

Read this topic
Take test on this topic

Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App