Question
Write a java program that designs a new gibberish language. Rules of the new language: 1. Words that begin with a consonant: All letters before
Write a java program that designs a new gibberish language. Rules of the new language:
1. Words that begin with a consonant: All letters before the initial vowel are placed at the end of the word followed by the word "and" which is added as a suffix at the end of the word.
For example: hello -> ellohand
2. Words that begin with multiple consonants: The whole consonant cluster is added to the end of the word followed by the suffix "and.
For example: child -> ildchand
3. Words that begin with vowels (a, e, i, o, u): convert as above but also prefix the word with the letter "v".
For example: it-> vitand
4. Words that have no vowels: Words that have no listed vowels (a, e, i, o, u) should be left alone. No need to be converted.
5. one exception: convert the word language to qazwsx, use an appropriate constant to represent the replacement word
Using the following three methods:
convertToNewLanguage (Scanner wordScanner) - Called from the main method and accepts a secondary scanner object that is pointing to that String. This method gradually builds the new language converted string by going through the phrase word-by-word and making use of a helper method called convertWord(). Returns a string representing the fully converted language for the phrase.
convertWord(String word) - Called from within convertToNewLanguage() and accepts a single word as a string parameter. This method converts the single word and returns it to the convertToNewLanguage() method.
isVowel(char ch) - Called from convertWord(), this boolean helper method accepts a single character and returns a boolean true if the character is a vowel (a, e, i, o, u) and false otherwise.
Sample Run:
Enter the phrase to be converted: Java is cool
==> AVAJAND VISAND OOLCAND
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started