Hey, Iam trying to write a java application that acts as a one-word Pig Latin translator. The program should:
1.ask the user to enter a word
2.convert the entered word into proper Pig Latin translation, (I have to use a method named translate to get the Pig Latin translation of the input word)
3.print the translated word on the screen
And it has to follow these rules:
oRule #1: Words that start with a vowel (A, E, I, O, U) should simply have the characters "way" appended to the end of the word. For example, the word "apple" translates into "appleway"
'Y' is not counted as a vowel for this rule.
oRule #2: Words that start with a consonant should have all consonant letters up to the first vowel moved to the end of the word and then "ay" is appended. For example, the word "chair" translates into "airchay"
'Y' is considered to be vowel in this rule, so the word "xylophone" translates into "ylophonexay"
It is possible that the word may not contain any vowels at all. In this case, following rule #2, you would simply append "ay" to the end of the word. For example, the word "crwth" translates into "crwthay"
oRule #3: When "Y" is the first letter of the word, the word should follow Rule #2. As an example, the word "yellow" translates into "ellowyay"
And I must write and use a method called translate. This method should NOT get any values from the user/keyboard - that job should be done by the main program. This method should be sent a String value from the main program. This string is the word which should be translated into Pig Latin. The method, then, should create a new string (you will need a local variable to hold this string temporarily). This new string will be the translation of the original word. Finally, this method will need to send the new string back to the main program so that the main program can print the final result.
Please enter a word: pig
Your word translated into Pig Latin is: igpay
Here's another example:
Please enter a word: latin
Your word translated into Pig Latin is: atinlay
I have no clue where to start. Any help would be helpfully.