The two classes you will create will implement the operations defined in the interface as shown in the UML class diagram above. In addition, BinarySearchArray will implement a static method testBinarySearchArray() that populates the lists, and lets the user interactively test the two classes by adding and removing elements. The parameter BinarySearch can represent either class and tells testBinarySearchArray which class to test. Steps to Implement: 1) To get started create a new project in IntelliJ called BinarySearch. Add a class to your project called BinarySearchArray. Then add another class BinarySearchArrayList and an interface called BinarySearch. The interface BinarySearch includes public method stubs as shown in the diagram. You are allowed to add BinarySearchArrayList to the same file as BinarySearch but don't add an access modifier to this class, or for easier reading, you can declare the classes in separate files with public access modifiers. Only the class containing the main method can be defined as public in files defining multiple classes. You should read up on interfaces if you are unfamiliar. An interface provides a template for defined behavior to a class that inherits from the interface. The implementation is left to the implementing class. A class that implements an interface must implement ALL the methods declared in the interface, unless the class inherits from another class that already implements one or more of those methods. This is convenient because different classes that implement the same interface solve a similar problem but in a different way. The interface is a promise of certain general behavior, and the concrete class provides the concrete specialized implementation. A GrazingMammal nurses (an abstraction or interface). A Cow nurses(a concrete object). 2) The two classes you will define are as follows: public class BinarySearchArray implements BinarySearch { } class BinarySearchArrayList implements BinarySearch{ } Since you are implementing the interface, as mentioned you must provide implementations of the interface methods exactly as defined in the interface. The interface has only the declarations. These methods will have the same signature as the interface but may be implemented very differently, as is the case in this assignment. This is logical since one class operates on arrays, the other on ArrayLists. Implementation Details (See the BinarySearch interface above - method name correspond to interface and class definitions)
The two classes you will create will implement the operations defined in the interface as shown in the UML class diagram above. In addition, BinarySearchArray will implement a static method testBinarySearchArray() that populates the lists, and lets the user interactively test the two classes by adding and removing elements. The parameter BinarySearch can represent either class and tells testBinarySearchArray which class to test. Steps to Implement: 1) To get started create a new project in IntelliJ called BinarySearch. Add a class to your project called BinarySearchArray. Then add another class BinarySearchArrayList and an interface called BinarySearch. The interface BinarySearch includes public method stubs as shown in the diagram. You are allowed to add BinarySearchArrayList to the same file as BinarySearch but don't add an access modifier to this class, or for easier reading, you can declare the classes in separate files with public access modifiers. Only the class containing the main method can be defined as public in files defining multiple classes. You should read up on interfaces if you are unfamiliar. An interface provides a template for defined behavior to a class that inherits from the interface. The implementation is left to the implementing class. A class that implements an interface must implement ALL the methods declared in the interface, unless the class inherits from another class that already implements one or more of those methods. This is convenient because different classes that implement the same interface solve a similar problem but in a different way. The interface is a promise of certain general behavior, and the concrete class provides the concrete specialized implementation. A GrazingMammal nurses (an abstraction or interface). A Cow nurses(a concrete object). 2) The two classes you will define are as follows: public class BinarySearchArray implements BinarySearch { } class BinarySearchArrayList implements BinarySearch{ } Since you are implementing the interface, as mentioned you must provide implementations of the interface methods exactly as defined in the interface. The interface has only the declarations. These methods will have the same signature as the interface but may be implemented very differently, as is the case in this assignment. This is logical since one class operates on arrays, the other on ArrayLists. Implementation Details (See the BinarySearch interface above - method name correspond to interface and class definitions)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
The two classes you will create will implement the operations defined in the interface as shown in the UML class diagram above.
In addition, BinarySearchArray will implement a static method testBinarySearchArray() that populates the lists, and lets the user interactively test the two classes by adding and removing elements. The parameter BinarySearch can represent either class and tells testBinarySearchArray which class to test.
Steps to Implement:
1) To get started create a new project in IntelliJ called BinarySearch. Add a class to your project called BinarySearchArray. Then add another class BinarySearchArrayList and an interface called BinarySearch. The interface BinarySearch includes public method stubs as shown in the diagram. You are allowed to add BinarySearchArrayList to the same file as BinarySearch but don't add an access modifier to this class, or for easier reading, you can declare the classes in separate files with public access modifiers. Only the class containing the main method can be defined as public in files defining multiple classes.
You should read up on interfaces if you are unfamiliar. An interface provides a template for defined behavior to a class that inherits from the interface. The implementation is left to the implementing class. A class that implements an interface must implement ALL the methods declared in the interface, unless the class inherits from another class that already implements one or more of those methods.
This is convenient because different classes that implement the same interface solve a similar problem but in a different way. The interface is a promise of certain general behavior, and the concrete class provides the concrete specialized implementation. A GrazingMammal nurses (an abstraction or interface). A Cow nurses(a concrete object).
2) The two classes you will define are as follows:
public class BinarySearchArray implements BinarySearch {
}
class BinarySearchArrayList implements BinarySearch{
}
Since you are implementing the interface, as mentioned you must provide implementations of the interface methods exactly as defined in the interface. The interface has only the declarations. These methods will have the same signature as the interface but may be implemented very differently, as is the case in this assignment. This is logical since one class operates on arrays, the other on ArrayLists.
Implementation Details (See the BinarySearch interface above - method name correspond to interface and class definitions)
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education