Question
Enter two lists of numbers within the range [0, 9] from keyboard, either use flag to denote end of the list or ask user to
Enter two lists of numbers within the range [0, 9] from keyboard, 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 ( duplicate elements are not allowed in a set) we have two sets A and B. Suppose the universal set is U = {0,1,2,,9}. implement the following functions:
Print out AB.
Print out AB.
Print out B 0 .
Print out (AB)A.
Output:
Please enter unique element and enter -99 to end the entering:
1
2
2
Element already exists, please reenter.
3
-99
Set A: {1, 2, 3}
Please enter unique element and enter -99 to end the entering:
2
3
4
-99
Set B: {2, 3, 4}
Union of set A and B: {1,2, 3, 4}
Intersection of Set A and B: {2,3}
Set B's Complement: {0,1, 5, 6,7,8,9}
Production of (intersection of Set A and B) and A: {(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres a Java program that implements the requested functions java import javautil public class SetOperations public static void mainString args Scanne...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started