Home | About | Calendar | Projects | Assignments | Classes | Resources
{Programming III }
     
 
ASSIGNMENT 8
 
REMINDERS
 
.Change class LinkStringSet to LinkStringMultiSet.

The current implementation of LinkStringSet stores only the words that have been added to the set. In keepting with the use of mathematical sets, duplicate words are ignored. Modify the class so that it stores a multiset. A multiset still only stores the words, but also keeps track of how many occurrences of each word there are..

Your task is to create a new class LinkStringMultiSet that in addition to storing the Word, stores how many ocurrences of the word there are.

.Optional.

Implement the + operator for class LinkStringMultiSet. The + operator should merge the two sets, resulting in a third set which is the combination of the two sets. For example:

First Set + Second Set = Resulting Set
Kelly 2
Nao 3
Fabiana 1
Talya 3
Maeve 1
Fabiana 1
Talya 2
Kelly 2
Maeve 1
Fabiana 2
Talya 5
Nao 3

 

Notice that order does not count. Nao appeared second in the first set, not at all in the second, yet appeared last in the resulting set. This is still a correct result for merging these two sets. The order of the resulting set does not need to have any relationship to the original set.

.Scoring.

This is a 100 point assignment.

.Resources.

[ A formal description of sets ]

  You will base the code for LinkStringMultiSet entirely on LinkStringSet, making only a few changes.
 
Page prepaed by Christian Day.
Site design by Kelly Moran
BackForward
 
 
Last Updated: