[SOLVED] CSE 241-Homework 7- a generic class hierarchy for sets and maps for Java

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Hw7-rizzdc.zip (91.5 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)

Homework # 7

In this homework, you will write a generic class hierarchy for sets and maps for Java.

 

GTUSetInt<T> is a Java interface with the following methods.

empty
  Test whether container is empty
size
  Return container size
max_size
  Return maximum size
insert
  Insert element, throws exception  InvalidParameterException if the element is already in the set
intersection

The returned set is the intersection of this set and the given set.

erase
  Erase element
clear
  Clear all content
find
  Get iterator to element
count
  Count elements with a specific value
begin
  Return iterator to beginning
end
  Return iterator to end

 

The class GTUSet<T> implements the GTUSetInt interface. It will keep its data using Java arrays. Do not use any Java Collection classes. It implements the intersection method as follows:

 

intersection
GTUSetInt<T> intersection(GTUSetInt<T>)

The returned set is the intersection of this set and the given set.

The class GTUMap<K, V> extends from GTUSet< javafx.util.Pair <K, V> > and implements the following extra method

at
  Access element
V at(K k) If k matches the key of an element in the set, the method returns a reference to its mapped value.

 

The class GTUIterator implements the following methods

Write your driver class to test the all the classes and all of their methods.

  • Hw7-rizzdc.zip