Question: Can someone do the part worth 7.5 marks Consider an array-based set which is very much like an ArrayBag-it is unordered (elements can be in

 Can someone do the part worth 7.5 marks Consider an array-based

Can someone do the part worth 7.5 marks

Consider an array-based set which is very much like an ArrayBag-it is unordered (elements can be in any order) BUT duplicates are NOT allowed. Write a complete ArraySet class with the methods and elements listed below. For full marks (15 max) your class should be generic (i.e., can store any type of object). For 10 (max) out of 15 pick an object from the semester (Die, Tally Counter, etc.) to use in your set's data array. For7.5 (max) out of 15 use integers for your set's data array. Your class should include: Appropriate data fields-an array of the correct type (see above) and an integer to track the number of valid items. Argumented constructor that sets the initial size of the array. Error checking for the argument is optional. add() -add an element (passed as an argument) to the set if there is room in the array. If not, do nothing. This means you DO NOT resize the array when you are out of room, simply stop adding items. remove() -remove an element (passed as an argument). Return true if element is found and removed from the set, false if not. Remember, when removing the element from the array, order does not matter. isFound() -return true if the element (passed as an argument) is present in the array, else return false. toString()- an appropriate toString method. Use the back of the page if you need more room for your solution

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!