Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement the functions for set operations and the CharSet class using Java Programming Language (2) Implement the functions for set operations Implement the basic operations
Implement the functions for set operations and the CharSet class using Java Programming Language
(2) Implement the functions for set operations Implement the basic operations of a set: union (), intersection (n), difference(-), subset. public class SetTesterf public static IntSet union (IntSet s1, IntSet s2) () public static IntSet intersection (IntSet s1, IntSet s2) ( h public static IntSet difference (IntSet s1, IntSet s2) ) public static boolean isSubSet (IntSet subset, IntSet superset) () public static void main (Stringl args) IntSet s1new IntSet ( IntSet s2 new IntSet 0: s1.add (4); s1.add (2) s1.add (-3); I/ s1 4,2, -3 ; s2.add (2); s2.add (-5); // s2 2,-5 ; IntSet s3, s4, s5; s3union (s1, s2); s3.print 0: //print: 4, 2, -3, -5 s4-intersection (s1, s2); s4.print 0 //print: 2 s5 difference (s1, s2); s5.print0 // print: 4, -3 System.out.println ( isSubSet (s4, s1)); // print: true System.out.println isSubSet (s5, s2) ); // print: false (3) Implement the CharSet class A set of characters s is a set whose elements are characters. Ex. S = {'a, 'b','c','d'), S = {'c','d', 'f'), Referring to the IntSet class, design, write and test a program that handles a set of characters Implement the methods and fields of the CharSet class and write its test program. 3, Evaluation Criteria (1) Program Description (2) Execution of the program 4. Submission of the followings: (1) Source Code (2) Program Description (3) Screenshot of the ResultsStep by Step Solution
There are 3 Steps involved in it
Step: 1
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