[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[EIJ]
[CS152 2000F]
[CS153 2004S]
Due: Friday, 10 September 2004
Create two classes, ThreeWordPhrase and TestTWP.
The first is to be a template for three-word phrases. The second is to
test your first.
You ThreeWordPhrase class should contain two constructors:
Your ThreeWordPhrase class should provide the following methods:
public ThreeWordPhrase reverse(), which returns the phrase backwards.
public String first(), which returns the first word.
public String second(), which returns the second word.
public String third(), which returns the third word.
public String toString(), which returns the whole phrase as a string (with spaces between the words).
int length(), which returns the length of the phrase in characters. (You may need to check the documentation for Strings.)
If you wish to implement other interesting methods for extra credit, you may.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[EIJ]
[CS152 2000F]
[CS153 2004S]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Wed Dec 8 10:36:51 2004.
The source to the document was last modified on Wed Sep 8 10:50:17 2004.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2004F/Homework/09.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby