Question: Java code for this. Thank you. SAMPLE RUN: Please enter integers for set A and enter -66 to end the entering: 0 1 2 3
Java code for this. Thank you.
SAMPLE RUN:
Please enter integers for set A and enter -66 to end the entering:
0
1
2
3
-66
Set A: {0, 1, 2, 3)
======================================
Please enter integers for set B and enter -66 to end the entering:
2
3
4
5
-66
Set B: {2, 3, 4, 5}
======================================
Union of Set A and B: {0, 1, 2, 3, 4, 5}
Set B's Complement (universal set is {0, 1, 2, ..., 9}): {0, 1, 6, 7, 8, 9}
Intersection of Set A and B: {2, 3}
Production of union of set A and B and B: {(2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (4, 0), (4, 1), (5, 0), (5, 1)}
Design a program to let user enter two lists of numbers within the range [0, 9] from keyboard, you could either use flag to denote end of the list or ask user to enter the list size first and then enter the list numbers. Each of these two lists represents a set (keep in mind that duplicate elements are not allowed in a set), so we have two sets A and B. Suppose the universal set is U 0, 1,2,,9). Write a program implementing the following functions: (a) Print out AUB. (b) Print out AnB. (c) Print out B d) Print out (AnB) x A
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
