Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make ArrayList that holds an unspecified number of objects. The object class should be created by you in a separate file. Make a new class

  1. Make ArrayList that holds an unspecified number of objects. The object class should be created by you in a separate file. Make a new class for this assignment- don't use a previous class.
  2. Your object class should be Comparable. Here's a quick tutorial on Comparable objects.(Links to an external site.) This will allow you to compare the objects using a compareTo method. It should also contain a toString method for ease of printing, an equals method, and any necessary accessors and modifiers.
  3. The objects should be added to the list in random order using whatever method you choose.
  4. Use a Merge Sort to sort the list (the code is easy to find in our books or online). The merge sort should be commented extensively to demonstrate your understanding of the algorithm. Do not use the Collections.sort() method.
  5. Print the list both before and after the sort.

MAKE AS SIMPLE AS POSSIBLE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Create a new class called MyObject that implements the Comparable interface Add necessary methods like compareTo toString equals accessors and modifie... 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_2

Step: 3

blur-text-image_3

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions