Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Unordered List can be used to implement a discrete set. Create a new JAVA cl

ID: 3709580 • Letter: T

Question

The Unordered List can be used to implement a discrete set. Create a new JAVA class called "ListSetOperator", which will be used to perform set operations with UList objects.

1) The class should include methods:

public UList union(UList Set 1, UList Set2)  that returns a reference to a new list containing all of the items from Set1 or Set2 with no repeats,

public UList intersect(UList Set1, UList Set2)  that returns a reference to a new list containing only the items from both Set1 and also Set2 with no repeats, and

public UList subtract(UList Set 1, UList Set2)  that returns a reference to a new list containing all of the items that are in Set1 but not Set2

2) Write a ListSetMain class to demonstrate that your methods work. Include code that displays the IDs of all of the elements in the resulting sets (in any order). Use "A', "B", "C",... as elements.

Explanation / Answer

Hi Dear,

As per the chegg guideline, please post one question per post.

I have answered Q1.

Please repost others in separate post.

Output:

Union: [A, B, C, D, E, F, K]
Intersection: [C, E]
Subtraction: [A, B, D]

Process finished with exit code 0

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote