Question
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
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,
99 was not found
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 SearchStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started