Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the three classes 'Split', 'Word', and 'Sentence'. Test your work using 'PigLatinTester'. PLEASE DON'T USE CHARAT ( ) OR STRINGBUILDER ( ) ! !
Write the three classes 'Split', 'Word', and 'Sentence'. Test your work using 'PigLatinTester'. PLEASE DON'T USE CHARAT OR STRINGBUILDER public class Split Declare String instance variables for first part and last part of the word. Write the constructor method. It will take one String parameter, the word to be split. In the constructor, do the following. Determine an index to be the breakpoint, as described below. Assign the substring before the breakpoint as the first part, the rest of the word as the last part. If word begins with quor Qureturns that substring as the first part. If word contains a ythat is not the first character or the last character, and that yis closer to the beginning of the word than any other vowels, consider ya vowel, and break on that y Otherwise the breakpoint should be at the first vowel aeioor u Write public accessor gettermethod called 'getFirst' returning the first part of the word. Use the signature public String getFirst Write public accessor gettermethod called 'getLast' returning the last part of the word. Use the signature public String getLast public class Word Declare a static int variable keeping track of the number of words instantiated. Declare a String instance variable to store pig latin translation of the word. Declare a Split instance variable to hold the Split object made from the word. Declare a boolean variable to record whether the the word was capitalized so the pig latin translation can be capitalized also Write the constructor. It take one String parameter for the word. The String methods toLowerCase andor toUpperCase may be useful in the constructor. In the constructor, do the following things Check to see whether the word is capitalized, and record whether or not it is capitalized in your instance variable. Next change the word to lowercase, and make a Split object from the lowercase word Store the split object in your instance variable. Then call the method makePigLatinWord described belowon the Split object and store the returned pig latin translation of the word in your instance variable. Add one to the static int variable, to record another Word instance. Write a accessor gettermethod called 'getPigLatinWord' returning the pig latin translation of the word. Use the signature public String getPigLatinWord Please help me Write an accessor gettermethod called 'getNumberOfWords' returning the number of words instantiated Use the signature public static int getNumberOfWords Please help me Write a method called 'makePigLatinWord' that takes the Split object as a parameter, and returns the pig latin translation of the word. The String methods toLowerCase andor toUpperCase may be useful in the method. Ensure that if the original word was capitalized, the pig latin translation is also capitalized; otherwise, make it uncapitalized. Use the signature public String makePigLatinWordSplit splitWord public class Sentence Declare String instance variables for the original sentence, and the pig latin translation of the sentence. Write the constructor. It will take one String parameter containing the sentence to be translated to pig latin. Assign the value of the sentence parameter to the instance variable. Traverse the characters in the sentence using looping and String methods you know. For each word a series of alphabetical characters AZ or azin the sentence, find a pig latin translation, and concatenate that String onto the pig latin translation of the sentence. As you encounter each new nonalphabetical character spacecomma period, question mark, exclamation point, etc.copy the character into the pig latin translation in the orginal order. Please help me write a 'toString' method that returns a string containing the original sentence, the pig latin translation of the sentence, and the number of words they both contain. Use the signature public String toString class PigLatinTester public static void mainStringargs Stringwords DearQueen "Mary", nothere "are", "not", "three", "yucky", "argyle", "socks", ina "drawer", byour "gym", "Love", "Abel"; StringsplitTestResults DearQueenMaryno therearenotthreeyuckyargyle socksinadrawerbyourgym LoveAbel; StringwordTestResults EardayEenquay "Arymay", "onay", "erethay", "areay", "otnay", "eethray", "uckyyay", "argyleay", "ockssay", "inay", "aay",
Write the three classes 'Split', 'Word', and 'Sentence'. Test your work using 'PigLatinTester'. PLEASE DON'T USE CHARAT OR STRINGBUILDER
public class Split
Declare String instance variables for first part and last part of the word.
Write the constructor method. It will take one String parameter, the word
to be split.
In the constructor, do the following.
Determine an index to be the breakpoint, as described below. Assign
the substring before the breakpoint as the first part, the rest of the
word as the last part.
If word begins with quor Qureturns that substring as the first part.
If word contains a ythat is not the first character or the last character,
and that yis closer to the beginning of the word than any other vowels,
consider ya vowel, and break on that y
Otherwise the breakpoint should be at the first vowel aeioor u
Write public accessor gettermethod called 'getFirst' returning the first part of the word.
Use the signature
public String getFirst
Write public accessor gettermethod called 'getLast' returning the last part of the word.
Use the signature
public String getLast
public class Word
Declare a static int variable keeping track of the number of words instantiated.
Declare a String instance variable to store pig latin translation of the word.
Declare a Split instance variable to hold the Split object made from the word.
Declare a boolean variable to record whether the the word was capitalized
so the pig latin translation can be capitalized also
Write the constructor. It take one String parameter for the word.
The String methods toLowerCase andor toUpperCase may be useful in the constructor.
In the constructor, do the following things
Check to see whether the word is capitalized, and record whether or not it
is capitalized in your instance variable.
Next change the word to lowercase, and make a Split object from the lowercase
word Store the split object in your instance variable.
Then call the method makePigLatinWord described belowon the Split object and
store the returned pig latin translation of the word in your instance variable.
Add one to the static int variable, to record another Word instance.
Write a accessor gettermethod called 'getPigLatinWord' returning the pig latin translation
of the word.
Use the signature
public String getPigLatinWord
Please help me Write an accessor gettermethod called 'getNumberOfWords' returning the number of words
instantiated
Use the signature
public static int getNumberOfWords
Please help me Write a method called 'makePigLatinWord' that takes the Split object as a parameter,
and returns the pig latin translation of the word.
The String methods toLowerCase andor toUpperCase may be useful in the method.
Ensure that if the original word was capitalized, the pig latin translation is
also capitalized; otherwise, make it uncapitalized.
Use the signature
public String makePigLatinWordSplit splitWord
public class Sentence
Declare String instance variables for the original sentence, and the pig latin translation
of the sentence.
Write the constructor. It will take one String parameter containing the sentence
to be translated to pig latin.
Assign the value of the sentence parameter to the instance variable.
Traverse the characters in the sentence using looping and String methods you know.
For each word a series of alphabetical characters AZ or azin the sentence,
find a pig latin translation, and concatenate that String onto the pig latin
translation of the sentence.
As you encounter each new nonalphabetical character spacecomma period,
question mark, exclamation point, etc.copy the character into the pig latin
translation in the orginal order.
Please help me write a 'toString' method that returns a string containing the original sentence, the
pig latin translation of the sentence, and the number of words they both contain.
Use the signature
public String toString
class PigLatinTester
public static void mainStringargs
Stringwords DearQueen "Mary", nothere "are",
"not", "three", "yucky", "argyle", "socks", ina
"drawer", byour "gym", "Love", "Abel";
StringsplitTestResults DearQueenMaryno
therearenotthreeyuckyargyle
socksinadrawerbyourgym
LoveAbel;
StringwordTestResults EardayEenquay "Arymay", "onay",
"erethay", "areay", "otnay", "eethray", "uckyyay", "argyleay",
"ockssay", "inay", "aay",
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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