Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an Eclipse Java project that utilize attached Selection Sort and Binary Search algorithms to search for an Employee object in an Employee[] of size

Create an Eclipse Java project that utilize attached "Selection Sort" and "Binary Search" algorithms to search for an Employee object in an Employee[] of size 5, for which, need to write an Employee class, which should have first name (type String), last name (type String), and Employee ID number (type int), as well as getters, setters, constructor and necessary compareTo() method that facilitate sorting based on last name or Employee ID number. You need to modify or adapt the attached "Selection Sort" and "Binary Search" methods so that they can work with class objects in this exam project. 

In the main() method, populate Employee array with sample Employee objects, perform Selection Sort() to sort the array, then test the binary Search method. The project should prompt the user for an Employee ID to search for, print unsorted array and sorted array as well as Binary Search results by displaying the first name, last name and Employee ID if the Employee object was found, otherwise, inform the user that the Employee object was not found.


public void selectionSort (Comparable [] list) int min; Comparable temp; for (int index = 0; index < list.length-1; index++) min = index; for (int scan index+1; scan < list.length; scan++) if (list[scan].compareTo ( (T) list [min]) < 0) min = scan; // Swap the values temp = list [min]; list[min] = list[index]; list[index] = temp; public Comparable binarySearch (Comparable [] list, Comparable target) int min = 0, max = list.length - 1, mid = 0; boolean found = false; while (!found &6 min

Step by Step Solution

3.43 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

I am s... 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

Document Format ( 2 attachments)

PDF file Icon
606ad568664a7_49720.pdf

180 KBs PDF File

Word file Icon
606ad568664a7_49720.docx

120 KBs Word File

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

Data Structures and Algorithm Analysis in Java

Authors: Mark A. Weiss

3rd edition

132576279, 978-0132576277

More Books

Students also viewed these Programming questions