Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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. You should remove all traces of the doSomething method in all the files before you submit your assignment.

You will write 3 new methods in the ArrayBag class:

bubbleSort - a method to sort the array in ascending order using the bubble sort

binarySearchIterative a repetitive version of the binary search

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:

display the contents of the bag using the class method toVector

add values to the bag

remove values from the bag

sort the bag

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.

Write your client code in a modular, structured fashion. Make sure you perform input validation where appropriate. This program should be bullet-proof and well documented. I am expecting code from a programmer who is in their third semester of writing software.

You will submit the following: All of program source and header files compressed into a zip file (.zip). Name your zip file lab1_Firstname_Lastname. You decide what to name the other files. Do not include .exe files.

Lab Grade Points

Labs will be graded on the following:

Comments

Including:

Program description (comment block at top of program)

Function descriptions for every function other than main() (see function heading below)

Comments at major algorithm steps (at a minimum)

Followed directions

Correct output

Structured program design

Meaningful identifier names

Function heading should look similar to this:

/******************************************************************************/

/* Function: functionName

/* Inputs: parameters passed and what they represent

/* Outputs: value(s) returned via return statemen or

/* on the parameter list

/* Purpose: This function blah blah blah.. describing what

/* the function does

/******************************************************************************/

NOTE The NEVER list of rules:

You will NEVER use break, exit, return, pass, continue or anything to leave a loop (or iteration), function, or other construct prematurely, unless it is part of the structure as in a case statement.

You will NEVER have a function call itself, unless it is intentional recursion.

You will NEVER use global variables. However, you may use global constants if it is appropriate and they are used properly.

You will have only one return statement in a function. (Exception Multiple return statements may be necessary in a recursive function.)

make sure this should be there ;

Function heading should look similar to this:

/******************************************************************************/

/* Function: functionName

/* Inputs: parameters passed and what they represent

/* Outputs: value(s) returned via return statemen or

/* on the parameter list

/* Purpose: This function blah blah blah.. describing what

/* the function does

/******************************************************************************/

please solve this questions.
image text in transcribed
QuEsnow 5 A ownec case canot reopent a metoe in fe sase casc Triun Fise QUESTON 6 The Fatie QUESTON 7 A pure uhai nenoc a a cmud renos a menoe ven no sate-caut raneicase nocast a wina nenoe w th inotserbeos Qurstion : mertinos oows net inol asoks True fine QUISTON 9 True Fake QUESTION to Triue Fake QUESTION 11 A cast neecoc tre nereest the ave of a cab atrous a covn at an7, onswatar acstitar muntor sonstuctior

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

Students also viewed these Databases questions

Question

How are construction estimates typically organized?

Answered: 1 week ago