PigLatinTranslator2 - /* / PigLatinTranslator2.java Author:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // PigLatinTranslator2.java Author: Lewis and Loftus // // Solution to Programming Project 5.1 //******************************************************************** / import java.util.StringTokenizer; i public class PigLatinTranslator2 { //----------------------------------------------------------------- // Translates a sentence of words into Pig Latin. //----------------------------------------------------------------- public static String translate (String sentence) { String result = ""; sentence = sentence.toLowerCase(); StringTokenizer tokenizer = new StringTokenizer (sentence); while (tokenizer.hasMoreTokens()) { result += translateWord (tokenizer.nextToken()); result += " "; } return result; } //----------------------------------------------------------------- // Translates one word into Pig Latin. If the word begins with a // vowel, the suffix "yay" is appended to the word. Otherwise, // the first letter or two are moved to the end of the word,
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 2

PigLatinTranslator2 - /* / PigLatinTranslator2.java Author:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online