You will use the array bag code that we reviewed in the text book. This code is provided with this assignment. In this code I have added one new method to the class for you to use as a guide.  write 3 new methods in the ArrayBag class:

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
 You will use the array bag code that we reviewed in the text book. This code is provided with this assignment. In this code I have added one new method to the class for you to use as a guide. 
write 3 new methods in the ArrayBag class:
  1. bubbleSort - a method to sort the array in ascending order using the bubble sort
  2. binarySearchIterative – a repetitive version of the binary search
  3. binarySearchRecursive - a recursive version of the binary search (You should use a helper method that calls the recursive method so the client code does not have to provide the extra parameters. Client calls to both of the search methods should be identical other than the method name.)
Load your bag with some initial values, but do not fill it completely.
Your client code should give the user the option to:
  1. display the contents of the bag using the class method “toVector”
  2. add values to the bag
  3. remove values from the bag
  4. sort the bag
  5. search for a value using their choice of either the iterative search or the recursive search - both need to be tested
Allow the user to keep doing these things until they are done.
Do not automatically sort the bag if the user chooses to search. Your program should give the user a message telling them they must first sort the bag before they can search. You must think of a way to detect programatically that the array has not been sorted.
You decide what the user interface will be.  Make it clear and easy to use.  It can be very basic; nothing fancy. A menu driven program works well.
Each value in your array should be unique - no value will appear in the array multiple times.
Your array elements can be any data type the client code wants to use – use a template class put in place in the code provided. You can write your client code to process a bag holding any data type you want.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage