Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer this exercise using java. SetImp.java public class SetImp implements Set{ private int set[]; private int count; public SetImp(){ set = new int[max]; count=0;

Please answer this exercise using java.

SetImp.java

public class SetImp implements Set{ private int set[]; private int count;

public SetImp(){ set = new int[max]; count=0; }

public SetImp(int size){ set = new int[size]; count=0; }

public void add(int num){ if(!(contains(num))) set[count++]=num; }

private boolean contains(int num){ boolean ans=false; for(int i=0;i

public void display(){ System.out.print("{"); for(int i=0;i

public Set union(Set s){ Set s1 = new SetImp(); for(int i=0;i

//public Set intersection(Set s); //public Set difference(Set s); //public boolean subset(Set s); //public boolean disjoint(Set s); //public int cardinality();

/*public static void main(String[] args){ Set set1 = new SetImp(); Set set2 = new SetImp(); Set set3 = new SetImp(); set1.add(1); set1.add(2); set1.add(3); set2.add(1); set2.add(4); set2.add(5); set1.display(); set2.display(); set3=set1.union(set2); set3.display(); }*/ }

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

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

Design a training session to maximize learning. page 296

Answered: 1 week ago

Question

Design a cross-cultural preparation program. page 300

Answered: 1 week ago