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: happy-> appyhand

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: great -> eatgrand

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: I -> viand; is -> visand

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.

For example: cs-> cs

Using the following three methods:

convertToNewLanguage (Scanner wordScanner) - Called from the main method and accepts a secondary scanner object (Scanner wordScanner = new Scanner(phrase)) 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. Make sure it works for upper and lower case character parameters and only the vowels a, e, i, o, u return true

Sample Run:

Enter the phrase to be converted: I think CS is cool

==> VIAND INKTHAND CS VISAND OOLCAND

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!