Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help filling in the parts. I've highlighted what needs completing. public class SetTester3 { public static void main(String[] args) { Set set1 = new

Need help filling in the parts. I've highlighted what needs completing. public class SetTester3 { public static void main(String[] args) { Set set1 = new TreeSet() ; set1.add("A") ; set1.add("B") ; set1.add("C") ; set1.add("D") ; set1.add("F") ; set1.add("G") ; System.out.println("set1, the tree set: " + set1) ; Set set2 = new TreeSet() ; set2.add("B") ; set2.add("D") ; set2.add("E") ; set2.add("F") ; set2.add("G") ; System.out.println("set2, the tree set: " + set2) ; System.out.println("C is in set1: " + set1.contains("C")) ; System.out.println("C is in set2: " + set2.contains("C")) ; System.out.println("Removing C from set1: " +set1.remove("C")) ; System.out.println("Removing C from set2: " +set2.remove("C")) ; Set set3 = difference(set1, set2) ; System.out.println("Difference: " + set1 + " - " + set2 + " = " + set3) ; } /** A method that returns the difference of two sets. @param x first set @param y second set @return the difference set, that is, x - y */ public static Set difference(Set x, Set y) { //-----------Start below here. To do: approximate lines of code = 5 // 1. fill in the difference method //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. } }

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

Multidimensional Array Data Management In Databases

Authors: Florin Rusu

1st Edition

1638281483, 978-1638281481

Students also viewed these Databases questions