Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Piglatin {
- public static void main (String [ ]argv ){
- System.out.println ("enter a word to be converted to piglatin");
- Scanner sc = new Scanner (System.in);
- String englishWord = sc.next();
- String firstVowel = sc.nextLine();
- char g = Character.toLowerCase(firstVowel.charAt(0));
- if (g == 'a' || g == 'e' || g == 'i'|| g == 'o'|| g == 'u'|| g == 'y'){
- String convertToPiglatin = firstVowel + "ay";
- System.out.println (convertToPiglatin);
- }
- else {
- String first = firstVowel.substring(0,1);
- String other = firstVowel.substring(1, firstVowel.length());
- System.out.println(other + first + "ay");
- }
- }
- }
Add Comment
Please, Sign In to add comment