Guest User

Untitled

a guest
Mar 13th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class PigLatin
  3. {
  4. //-----------------------------------------------------------------
  5. // Reads sentences and translates them into Pig Latin.
  6. //-----------------------------------------------------------------
  7. public static void main (String[] args)
  8. {
  9. String sentence, result, another = "y";
  10. Scanner scan = new Scanner (System.in);
  11. PigLatinTranslator.translate(sentence);
  12. while (another.equalsIgnoreCase("y"))
  13. {
  14. System.out.println ();
  15. System.out.println ("Enter a sentence (no punctuation):");
  16. sentence = scan.nextLine();
  17. System.out.println ();
  18. result = PigLatinTranslator.translate (sentence);
  19. System.out.println ("That sentence in Pig Latin is:");
  20. System.out.println (result);
  21. System.out.println ();
  22. System.out.print ("Translate another sentence (y/n)? ");
  23. another = scan.nextLine();
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment