Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

What are the general types of interviews? Explain each.

Answered: 1 week ago

Question

6 How can HRM contribute to ethical management and sustainability?

Answered: 1 week ago