Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

it should be in java! comments explaining the code will be helpful too please Implement a class, IntegerSet, given the specification below. public class IntegerSet

it should be in java! comments explaining the code will be helpful too please
image text in transcribed
image text in transcribed
Implement a class, IntegerSet, given the specification below. public class IntegerSet // Hint: probably best to use an array list. You will need to do a little research private List Integer>set=new ArrayListO: // Clears the internal representation of the set public void clear() {...}; // Returns the length of the set public int length ...}; // returns the length Returns true if the 2 sets are equal, false otherwise: * Two sets are equal if they contain all of the same values in ANY order public boolean equals(IntegerSet b) {...}; // Returns true if the set contains the value, otherwise false public boolean contains(int value) <...>; // Returns the largest item in the set; Throws a IntegerSetException if the set is empty public int largest() throws IntegerSetException ...); // Returns the smallest item in the set; Throws a IntegerSetException if the set is empty public int smallest() throws IntegerSetException; // Adds an item to the set or does nothing it already there public void add(int item) {...}; //adds item to s or does nothing if it is in set // Removes an item from the set or does nothing if not there public void remove(int item) {...}; // Set union public static void union(IntegerSet intSetb) (..-}; // Set intersection public static public void intersect(IntegerSet intSetb) {...}; // Set difference, i.e., sl-s2 public static void diff(IntegerSet intSetb); // set difference. i.e. sl - s2 // Set union public static void union(Integer Set intSetb) {...}; // Set intersection public static public void intersect(IntegerSet intSetb) {...}; // Set difference, i.e., sl-s2 public static void diff(Integer Set intSetb); // set difference, i.e. sl - s2 // Returns true if the set is empty, false otherwise boolean isEmptyO; // Return String representation of your set public String toString{...}; // return String representation of your set } Everyone should commit their work to the same repository you used for assignment 1 and 2. Your package structure should be: or asp.assignment4.test (contains your test/driver code) org. u.Isp.assignment4.implementation (contains your implementation classes) As with assignment 1 and 2, your program should have a Driver class that invokes and tests your implementation. Your implementation should have enough test cases to prove that your solution works. Input can be hard-coded, no need to build a UI or read from stdin/screen. Output should be clear and similar to the above. You are not allowed to change any of the details described above in class IntegerSet. Your implementation code should not output anything to the screen/stdin. Output should be expressed in your Driver code. Once again, part of your grade will be based on how well you show your work in your output. This assignment requires a little research on your own. (1) Figure out how to use an ArrayList as your set implementation and (2) Figure out how to create a throw a user defined exception. Ask questions on Piazza if you have any questions. Finally, you are required to generate and submit the html documentation from the javdoes in your code. Once again, this will require a little research. For those using eclipse, this can typically be done within the IDE

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago