Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help making this Java class. If anything I at least need help with the sorting methods (selectionSort and insertionSort). I am stuck and

I need help making this Java class. If anything I at least need help with the sorting methods (selectionSort and insertionSort). I am stuck and confused and need a lot of help. Thanks

The PersonSort class is the tester class for this program. It has four static methods: main, populate, selectionSort and insertionSort.

The main method

creates an ArrayList (ArrayList) of Person objects

populates it from a file that is supplied to you

copies the ArrayList to another one

uses the first ArrayList and sorts it using an insertion sort algorithm

displays the sorted ArrayList

uses the second ArrayList and sorts it using a selection sort algorithm

displays the sorted ArrayList

The populate method reads in the Person data from a file (see below for the format). See slide 99 for a good example of how to do this. DO NOT assume that you know how many records are in the file. It creates a Person object from each line in the file and adds the object to the first ArrayList.

The selectionSort method sorts the ArrayList using the selection sort algorithm.

The insertionSort method sorts the ArrayList using the insertion sort algorithm.

You must implement these sorting algorithms. A version of this code is containined in the Lesson 3 Source Code. You are not permitted to use the sort method of the Collections framework, or its swap method.The Person objects must be sorted, first by birthday and then by name.

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

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions

Question

305 mg of C6H12O6 in 55.2 mL of solution whats the molarity

Answered: 1 week ago

Question

Describe the job youd like to be doing five years from now.

Answered: 1 week ago

Question

So what disadvantages have you witnessed? (specific)

Answered: 1 week ago