Question: Determining Equality [10 pts] The need to determine if two objects are equal is quite common in most application development (coding) scenarios. How will you

 Determining Equality [10 pts] The need to determine if two objects

Determining Equality [10 pts] The need to determine if two objects are equal is quite common in most application development (coding) scenarios. How will you determine if 2 bags are equal and what criterion should be used to do so. Although the logic governing equality of any two bags could potentially vary based on business requirement(s), one effective way could be based on comparing the frequencies of the items in the bags. Refer to the class discussion on the topic of equality and write a method equals for your MyArrayBag class from Assignment-1 that returns true if two bags are equal (have same frequencies for each object). The method signature could look as follows: public boolean equals(MyArrayBag aBag) \{ //algorithm code \} Hint: Scan over the items in one bag and use the method getFrequencyOf() with both bags

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!