The Generic Set Class Definition of a set The basic characteristics of a mathema
ID: 3561523 • Letter: T
Question
The Generic Set Class
Definition of a set
The basic characteristics of a mathematical set are:
(a) A set is an unordered collection of elements;
(b) the size of a set is unlimited;
(c) the order of the elements in the set is irrelevant;
(d) duplicate values in a set have no meaning.
The basic function defined for a single set is: does the set contain an element.
Four basic two-sets functions are defined (for sets A an B):
1. union, (the set that contains those elements that are either in A or in B, or in both)
2. intersection, (the set containing those elements in both A and B)
3. inclusion, (is set A a subset of set B?)
4. complementation, (the set containing those elements in B, but not in A)
The Lab Exercise
The main aim of the exercise is to design an abstraction for the mathematical set functions in
Java using the object-oriented approach.
You are to develop a project plan according to the following steps (no implementation of classes!
is to be written at this time):
1. Choose the appropriate class/classes needed in order to perform the specified required
operations.
2. For each class, plan the required attributes and methods using CRC card(s).
3. Define the type of each attribute. Define the header of each method.
4. Create the javadoc readable documentation of the class(s).
5. For each method, write an example of the method invocation.
Basic Operations on a Single Set
Operation Documentation
Create a set Returns a Set object
Is set empty? Returns true if set is empty, or false if not
Is element in set? Returns true if given element is in the set and false if not
Basic Operations on a Two Sets
Operation Documentation
Union Returns the union set of the two sets
Intersection Returns the intersection set of the two sets
Containing Returns true if the given set is a subset of this set and
false if not
Complement Returns the set of elements of this set that are not
elements of the given set
Explanation / Answer
contact on timacs12@gmail.com
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.