Next: Problem Design: PigLatinApplet
Up: In the Laboratory: Pig
Previous: The Algorithm
The above analysis leads to the following specification for the
PigLatin class. Its main role is to translate English expressions into Pig
Latin. One design we could use here is to model PigLatin after
the Math class -- that is, as a utility class which provides a
useful method, but which is not designed to be instantiated at all.
- Purpose: To translate an English expression into Pig Latin.
- Modifiers: final, so it cannot be extended.
- Constructor: private, so no instantiation is possible.
- Instance variables: None (no need to store anything).
- Public instance methods: None (no need to have instances).
- Public static method: translate(String) translates
its String parameter into Pig Latin.
- Private static method: translateWord(String) translates
a single word into PigLatin.
- Private static method: findFirstVowel(String) returns
the location of the first vowel in its String parameter.
As this design suggests, the PigLatin class will
have only one public method but will utilize the private
methods described above to help perform its task.
Ralph Morelli {Faculty}
12/22/1999