Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA : Create a project that uses the Binary Search algorithm to search for objects of type Circle, Fraction, FeetInches, Integer, Rectangle. Make sure

IN JAVA: Create a project that uses the Binary Search algorithm to search for objects of type Circle, Fraction, FeetInches, Integer, Rectangle. Make sure they each have a compareTo.

In main you will need to create 4 arrays. An array of 12 rectangles, an array of 20 circles, an array of 24 Fractions, and an array of 16 FeetInches.

There is an input file that contains data from which you will be able to create these arrays.

First, the length and width of the 12 rectangles, then 20 reals for the radii of the 20 Circles, then 24 numerator/denominator pairs to create the 24 Fractions, then 16 feet/inches pairs for the FeetInches objects. Note that they are sorted, which is necessary for the Binary Search algorithm.

Print out the contents of your arrays (this will help you to debug)

Create FOUR binary search methods ALL WITH THE SAME NAME, but the parameters will be different in that they will be of different types).

Then ask your user for TWO length/width pairs. (For debugging purposes enter one which is in the array, one which is not. Since you printed out the contents of your array you can easily find which are in the array and the index). If in the array your binary search algorithm should return the index where it is, if not it should return -1.

Then ask your user for TWO radii. If in the array your binary search algorithm should return the index where it is, if not it should return -1.

Then ask your user for TWO numerator/denominator pairs. If in the array your binary search algorithm should return the index where it is, if not it should return -1.

Then ask your user for TWO feet/inches pairs. If in the array your binary search algorithm should return the index where it is, if not it should return -1.

BS.in:

1.5 1.0 1.6 2.0 2.2 2.9 2.3 3.0 3.2 3.5 3.4 4.0 4.0 4.0 4.0 4.2 4.0 4.4 5.0 5.2 5.9 6.0 6.2 7.0 1.1 1.3 2.5 2.6 2.9 3.3 3.5 3.6 3.8 4.1 4.2 4.7 4.8 4.9 5.1 5.3 5.7 5.8 5.9 6.0 1 16 2 16 3 16 4 16 5 16 6 16 7 16 8 16 9 16 10 16 17 16 18 16 19 16 20 16 21 16 22 16 23 16 24 16 25 16 26 16 27 16 28 16 29 16 30 16 1 16 2 16 3 16 4 16 5 16 6 16 7 16 8 16 9 16 10 16 17 16 18 16 19 16 20 16 29 16 30 16

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

Students also viewed these Databases questions

Question

Write down the circumstances in which you led.

Answered: 1 week ago