Your method should count the number of words in the


Write your code in the file PigLatin.java. Your code should go into a method with the following signature. You may write your own main method to test your code. The graders will ignore your main method:

public static String translate (String original){}

Write your code in the file WordCount.java. Your code should go into a method with the following signature. You may write your own main method to test your code. The graders will ignore your main method:

public static int countWords(String original, int minLength){}

Your method should count the number of words in the sentence that meet or exceedminLength (in letters). For example, if the minimum length given is 4, your program should only count words that are at least 4 letters long.

Words will be separated by one or more spaces. Non-letter characters (spaces, punctuation, digits, etc.) may be present, but should not count towards the length of words.

Hint: write a method that counts the number of letters (and ignores punctuation) in a string that holds a single word without spaces. In your countWords method, break the input string up into words and send each one to your method.

"Pig Latin" is a fake language used as a children's game. A word in English is "translated" into Pig Latin using the following rules:

  • If the English word begins with a consonant, move the consonant to the end of the word and add "ay". The letter Y should be considered a consonant.
  • If the English word begins with a vowel (A, E, I, O, or U), simply add "way" to the end of the word.

(This is a simplified dialect of Pig Latin, of course.)

Write your method so that it returns the pig latin translated original string. You may assume that the input does not contain digits, punctuation, or spaces. The input may be in any combination of uppercase or lowercase. The case of your output does not matter.

Solution Preview :

Prepared by a verified Expert
Macroeconomics: Your method should count the number of words in the
Reference No:- TGS01674358

Now Priced at $20 (50% Discount)

Recommended (96%)

Rated (4.8/5)