Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could someone help me code the following lab in JAVA? I'm a little confused by it, and I would appreciate // marks where you tell

Could someone help me code the following lab in JAVA? I'm a little confused by it, and I would appreciate // marks where you tell me what you did so I can follow along.

Part One:

Create a class called Person.java that implements Comparable (remember, the Comparable Interface is already built into Java, you dont have to write it). Include at least two data fields, a constructor, accessor methods, a toString method and the required compareTo method.

Choose your own data fields and your own implementation for compareTo.

Part Two:

Create a driver that asks the user how many people they would like to enter. Create an array of Person objects of that size.

Have the user "create" each person by entering all data fields.

After the last Person is entered, perform an insertion sort by calling Person's compareTo method.

Insertion sort must be a separate method that you call from main. The method header should look like:

public static void insertionSort(Person[] list)

Output your sorted array and verify that the elements are in ascending order.

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

More Books

Students also viewed these Databases questions

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

4. What are the current trends in computer software platforms?

Answered: 1 week ago