plz help me in solving this question & I need the answer quickly

(Set of Integers) Create class IntegerSet. Each IntegerSet object can hold integers in the
range 0100. The set is represented by an array of bools. Array element a[i] is TRue if integer i
is in the set. Array element a[j] is false if integer j is not in the set. The parameterless
constructor initializes the array to the "empty set" (i.e., a set whose array representation contains
all false values).
Provide the following methods:
a. Method Union creates a third set that is the set-theoretic union of two existing sets (i.e.,
an element of the third set's array is set to true if that element is true in either or both of
the existing setsotherwise, the element of the third set is set to false).
b. Method Intersection creates a third set which is the set-theoretic intersection of two
existing sets (i.e., an element of the third set's array is set to false if that element is
false in either or both of the existing setsotherwise, the element of the third set is set to
true).
c. Method InsertElement inserts a new integer k into a set (by setting a[k] to true).
d. Method DeleteElement deletes integer m (by setting a[m] to false).
e. Method ToString returns a string containing a set as a list of numbers separated by
spaces. Include only those elements that are present in the set. Use --- to represent an
empty set.
f. Method IsEqualTo determines whether two sets are equal.
Write an application to test class IntegerSet. Instantiate several IntegerSet objects. Test that
all your methods work properly

This for sure is a a school project (isnt it)?
So, do you have created any code? Show us how it really looks this Array.

Anyway, indexes must have numbers (not must, there always is a number, because array[T] means array as number T has some value), othwewise this is not an array. This really is some strange homework.

I have solved, but what's wrong in this code?

`

1.  public String toSetString()
2. {
3. String result = "";
4. for (int i = 0; i < 100; i++)
5. {
6. result += ((integers[i]) ? i : "---") + " ";
7. }
8. return result.Substring(0, result.Length - 1);
9. }

`

Edited 4 Years Ago by R.K.3

This article has been dead for over six months. Start a new discussion instead.