Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help implementing this method for both, the dynamic and the static classes. Useful methods This is the method to complete. 3. Suppose you

I need help implementing this method for both, the dynamic and the static classes.
image text in transcribed
Useful methods
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
This is the method to complete. image text in transcribed
3. Suppose you are given an array of Set instances. Write a non-member static method called checkDisjoint() which returns true if the intersection of the array is empty. The prototype for the method is: public static boolean checkDisjoint (Object() sets) @Override public Set difference(Set S2) { Set $3 = new StaticSet(DEFAULT_SET SIZE); for (Object obj : this) E e = (Emmobi; if (!$2.isMember(e)) S3.add(e); return S3; @Override public Set intersection (Set S2) { return this.difference(this.difference(S2)); @Override public boolean isMember(E obj) { for (int i = 0; i implements Set { // current number of elements in set private int currentSize; // array of elements private E elements[]; private static final int DEFAULT_SET_SIZE = 10; @SuppressWarnings("unchecked") public staticSet(int maxCapacity) { if (maxCapacity implements Iterator { private int currentPosition; in in public SetIterator() { this.currentPosition = 0; import java.util.Iterator; 5 public class Dynamicset implements Set { // static set private StaticSet theSet; 10 // current max capacity private int maxCapacity; 13 14 private static final int DEFAULT_SET_SIZE = 10; 150 16 public DynamicSet(int initialCapacity) { this.theSet = new StaticSet(initialCapacity); this.maxCapacity = initialCapacity; 17 18 190 @Override public Iterator iterator() { return theSet.iterator(); 21 A public static boolean checkDisjoint(Object[] sets) { return false

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions