C# Class

profileZamti753

Write two interfaces, IWordStructure and IOrderedWordStructure.

IWordStructure should have the following methods:

  • a read-only property: numberOfWords that returns an integer
  • insertWord (string)
  • includesWord(string) and that returns a boolean
  • deleteWord(string) and return boolean indicating the success

 IOrderedWordStructure should inherit from IWordStructure. It should have the following methods:

  • wordAt(nt) that returns the word at the index location
  • positionContains (string, int) returns a boolean

 

After writing the interfaces, create a collection class named StringCounter. It should implement the IOrderedWordStruture, mentioned above. It should have the following methods:

  • wordList, which returns an array containing the strings in the collection
  • CountEntry, which has three parameters. The first is a zero-based index indicating the position in the collection for which data is to be returned. The next two parameters are out mode. The first is used to return the string at the index position. The second is used to return the count for the string being returned in the second parameter.

These are additional requirements:

  • Use an array of structs to keep the data (the struct type should be like the one used in-class when writing the WordCount program; which is on the I: drive)(note : the file on the attachment )
  • The array should initially be able to hold 10 entries. Whenever the array fills up and additional locations are needed, allocate a new array twice the size of the one that is full, copy the entries in the old array to the new one, and let the old array be deallocated.
  • Write a program to test the new class. The class will be used in a late lab.
  • 9 years ago
  • 20
Answer(1)

Purchase the answer to view it

blurred-text
NOT RATED
  • attachment
    wordcounter.doc
  • attachment
    jiju.txt
  • attachment
    output.png