Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago