{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW2 2 - t t T he f irst i nventory w ould c orrespond o...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
The first inventory would correspond to [beegghorsuw], the second would correspond to [aaaabbckmor] and the third would correspond to [aaaabbbceegghkmoorrsuw]. You should implement this class with an anay of 26 counters (one for each letter) along with any other data fields you find that you need. Remember, though, that we want to minimize the number of data fields when possible. You might be tempted to implement the add method by calling the toString method but you are not allowed to use that approach because it would be inefficient for inventories with large character counts. You will need to know certain things about the properties of letters and type char. There is a section about type char in chapter 4 of the textbook. One of the most important ideas is that the values of type char have corresponding integer values. There is a character with value 0, a character with value l, a character with value 2 and so on. You can compare different values of type char using
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online