In the lab for this week you ``implement'' some of the Word class....
- new Word () -- < Word >
- new Word (< String >, < String [] >) -- < Word >
- < Word > .word () -- < String >
- < Word > .syllables () -- < String [] >
- < Word > .length () -- < int >
- < Word > .nrsyllables () -- < int >
- < Word > .describe ()
- < Word > .print ()
- < Word > .less (< Word >, < Word >) -- < boolean >
- < Word > .lastSyllable () -- < String >
By analogy with the lab, start implementing the Dictionary class...
- new Dictionary (< String >) -- < Dictionary >
- < Dictionary > .add (< Word >)
- < Dictionary > .add (< String >)
- < Dictionary > .display ()
Add and test one element of functionality of the Word class ata time until it is complete...
One at a time, implement and test the items of functionality of the Dictionary class.
Write a method to search an array of integers for a given integer. Unlike the search methods of your Dictionary class, this will be a static method.
static private boolean search (int x, int a [])
{
for (int i = 0; i < a.length; i + +)
{
if (a [i] == x)
{
return true;
}
}
return false;
}
|
if (Word.equal (w [i], x))
|
SORTING
for (int p = 0; p < a.length; p + +)
{
for (int s = p + 1; s < a.length; s + +)
{
if (a [p] > a [s])
{
int temp = a [p];
a [p] = a [s];
a [s] = temp;
}
}
}
|