Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a Java GUI application that prompts the user for the list of integers delimited by commas and a number to search using binary search

Implement a Java GUI application that prompts the user for the list of integers delimited by commas and a number to search using binary search algorithm. The below screen shot is expected

image text in transcribed

The GUI layout includes:

A JLabel control to display the message: Specify the list of numbers for binary-searching, delimited by commas.

A JTextField control to accept the list of integer numbers delimited by commas.

A JLabel control to display the message: Specify number to search.

A JTextField control to accept an integer (key) to search for.

A JButton (labelled as Search) Pressing this button will perform binary-searching for the specified key number.

A JLabel control to display the search result. This JLabel control must have a black border.

Its recommended to use the binary search code (function) from the demo, BinarySearchTest, prepared for Session 8 for this code project with some modifications. Alternatively, you can use the binarySearch() method of the class Arrays.

If the search number is found, display the message to indicate that its found and its index in the list of numbers entered by the user. For example,

99 was found in position 14

If the search number cannot be found, display the message to indicate that it cannot be found. For example,

Binary Search Specify the list of numbers for binary-searching, delimited by commas: 12, 18, 23, 28, 31, 40, 52, 69, 73, 76, 77, 78, 78, 86, 95 Specify number to Search: 33 Search

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions