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 datafields you find that you need. Remember, though, that we want to minimize the number of data fields whenpossible. You might be tempted to implement the add method by calling the toString method but you are notallowed 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 havecorresponding integer values. There is a character with value 0, a character with value l, a character with value2 and so on. You can compare different values of type char using
This is the end of the preview.
access the rest of the document.