Question: import java.util.Scanner; public class SetDriver { public static void main ( String [ ] args ) { int [ ] A = new int [

import java.util.Scanner;
public class SetDriver {
public static void main(String[] args){
int[] A=new int[10];
int[] B=new int[10];
int[] AUB=new int[10];
int[] AnB=new int[10];
int[] BC=new int[10];
int[] AM=new int[10];
int n=0,m=0;
Scanner sc=new Scanner(System.in);
A=getElements(sc);
n=getLength(A);
System.out.print("
Set A: ");
printElements(A,n);
System.out.println("
================================================");
B=getElements(sc);
m=getLength(B);
System.out.print("
Set B: ");
printElements(B,m);
System.out.println("
================================================");
System.out.print("Union of set A and B: ");
union(A,n,B,m);
System.out.print("
Intersection of set A and B: ");
intersetion(A,n,B,m);
System.out.print("
Set B's complement: ");
complement(B,m);
System.out.print("
Production of (intersection of set A and B) and A: ");
production(A,n,B,m);
}
public static int[] getElements(Scanner sc)
{
int n=0;
int[] A=new int[10];
System.out.println("Please enter unique element and enter -99 to end the entering:");
while(n<10)
{
A[n]=sc.nextInt();
n++;
if(A[n-1]==-99){
return A;
}
for(int i=0;i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!