Guest User

Untitled

a guest
Jun 23rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Piglatin {
  3. public static void main (String [ ]argv ){
  4. System.out.println ("enter a word to be converted to piglatin");
  5. Scanner sc = new Scanner (System.in);
  6. String englishWord = sc.next();
  7.  
  8. String firstVowel = sc.nextLine();
  9. char g = Character.toLowerCase(firstVowel.charAt(0));
  10. if (g == 'a' || g == 'e' || g == 'i'|| g == 'o'|| g == 'u'|| g == 'y'){
  11. String convertToPiglatin = firstVowel + "ay";
  12. System.out.println (convertToPiglatin);
  13. }
  14. else {
  15. String first = firstVowel.substring(0,1);
  16. String other = firstVowel.substring(1, firstVowel.length());
  17. System.out.println(other + first + "ay");
  18. }
  19.  
  20.  
  21.  
  22.  
  23. }
  24. }
Add Comment
Please, Sign In to add comment