javac -Xlint:unchecked ArrBag.java
(or whatever file name)
A Bag is an Abstract Data Type or ADT. It is a container similar to a Set concept in that it implements operations such as add, remove, contains and so on, but it has no restriction about duplicates. In this project we will write a class that represents a bag. Our implementation will however add the restriction of duplicates. No duplicates wll be allowed into the container we are writing. Thus our arrBag is a set. A second important property of our implementation will be that it uses Java's Generics (sometimes mis-referred to as Templating by those who have programmed in C++). Generics is a powerful technique that allows the programmer to write the definition of the class in such a way that the container is capable of storing many different types of objects. The programmer only writes one version of the code for the class. Many clients can use this definition to store whatever type they wish as long as the type being stored supports all the operations that the code exercises on the data.
Since our version of the Bag ADT will implement some set functionality it will be somewhat of a hybrid between Bag and Set. These set specific operations provide excellent examples to work out the syntax for passing Bags into the methods of other Bags and operating on the internals of one another.
You are given a working sample ArrBagDemo1.java which you must use as a guide to fill in your starter file ArrBag.java and run that ArrBag.java file against the tester ArrBagTester.java
Execute like this: java ArrBagTester set1.txt set2.txt
Inside your starter file will be several methods written for you and several others with empty skeletons that you must fill in. We will go over the semantics of the set operations and the upSize method in class.
You should only write and compile one method at a time as you fill in methods of the starter file.
Here is a screen shot of what the output should look like then the scoring value of each line added on the left side.