Reference no: EM132200863
Write a Java program that uses one-dimensional arrays to implement finite sets and set operations union, difference, and intersection.
Specific requirements:
1. Elements of a set are integers from 1 to 20.
2. Use 0 as the end of a set. See examples below.
3. Prompt user to enter two sets A and B and calculate B union A, B \ A, and A intersection B
Here is a sample:
Input (user input example)
Enter elements of set A: 2 4 6 7 9 0
Enter elements of set B: 1 3 5 7 9 10 18 0
Output
Union of A and B is: 1, 2, 3, 4, 5, 6, 7, 9, 10, 18
Intersection of A and B is: 7, 9
Difference of A and B is: 2, 4, 6