Starting from:
$30

$24

Homework # 8 Inheritance and Generics in Java Solution

In this homework, you will write a generic Java class hierarchy for a simple container class hierarchy.




The class GTUContainer is an abstract class with the following abstract methods.







empty




Test whether container is empty




size




Return container size




max_size




Return maximum size




insert




Insert element, throws exception java.lang.IllegalArgumentException if there is a problem with insertion




erase




Erase element




clear




Clear all content




iterator




Return iterator to beginning

contains(Object o)







Returns true if this collection contains the specified element.




The class GTUSet<T extends from the super class and implements all of the methods appropriately for a set class.




The class GTUVector<T derives from the base class and implements all of the functions appropriately for a vector class. You may write other helper classes to make your work easier.




All classes will keep their data using Java arrays. Do not use Java collection classes.







The class GTUIterator implement these two iterator methods: next, hasNext as defined in https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html







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



Notes




Use appropriate comments for JavaDoc and submit your documentation files.
Test each method of each class at least once by writing driver code.



You should submit your work to the moodle page and follow all the submission rules that will be posted.

More products