Due: Tuesday, October 31, 2017 @ 10:00AM
Write a program that translates an English word into a Pig Latin word. Input ONE, and ONLY one, word from the user, and then output its translation to Pig Latin.
The rules for converting a word to Pig Latin follow.
Use at least the REQUIRED METHODS listed below, with the exact same SPELLING for method names and parameters.
Input ONE English word as a string. If multiple words are entered ignore any beyond the first.
Use PRECISELY the format below with the EXACT same SPACING and SPELLING.
Please enter a word ==> <user input>
Output an introductory message, a prompt for the English word, and a translation for the inputted word.
Use PRECISELY the format below with the EXACT same SPACING and SPELLING. The output below assumes the user entered "Hunger".
This program will convert an English word into Pig Latin.
Please enter a word ==> Hunger
"Hunger"
in Pig Latin is
"unger-Hay"
// Prompt and read a word to translate
public static String readWord (Scanner console)
// Convert a word to Pig Latin and return it
public static String convertWord (String englishWord)
// Return true if "c" is a vowel, false otherwise.
// Handle both lowercase and uppercase letters.
public static boolean isVowel (char c)
// Print result of translation
public static void printResult (String englishWord, String pigLatinWord)
BEFORE you start coding, think about which methods each method will call. Which methods should "main" call? Create a diagram which shows the calling relationships.
There are many useful String methods listed HERE. You may find startsWith
and charAt
helpful.
Use good programming style:
Ctrl+Shift+F
will format your code)Please name your program PigLatin.java
Submit the Java source code file on Autolab under the "Lab 7" assignment.