Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The code is c++ I am not sure what you need exactly. But whatever it is, just tell me. Thank you 01. ArrayBag - Embedded

The code is c++ image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
I am not sure what you need exactly.
But whatever it is, just tell me.
Thank you image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
01. ArrayBag - Embedded Coding Lab Requested files: Baginterface.h, ArrayBag.cpp, Bag_test.cpp (Download) Maximum number of files: 8 Type of work: Individual work Create a class ArrayBag derived from Baginterface which implements the Bag Abstract Data Type (ADT). Baginterface.h defines the following public interface functions: 1. Bago - Create and Empty Bag 2. void additem(Item item) - add an item to the Bag 3. boolean isEmpty() - indicate whether or not the bag is empty 4. int size() - return the number of items in the Bag Once you have created your bag, print a report of the bag size. There is a binary file of signed 32-bit integers in Little- Endian format. Your test program must open this file and insert all the integers into a bag using the interface functions. Print a report of the gag size. Baginterface.h The header file defining the interface to the Bag ADT ArrayBag.cpp An array based implementation of the Bag ADT Bag_test.cpp This source component includes the main() function, creates and tests instances of the Bag 01-02 The Bag ADT - Implementation - Using Arrays The array is a very useful data structure because any element can be accessed in constant time. This constant time is the same for any element whether it is the first in the array, element[0] or the last in the array element[N]. However the array requires that storage for all the elements be allocated before any of them can be used. If you don't know exactly how many elements you need you have to guess.. Working with arrays under conditions where you do not know the exact maximum number of elements required means that you may have to change the size. However once an array has been allocated, it is immutable meaning the size can't be changed. If your array needs to grow or shrink, you must allocate an array of the new size and copy elements from the old array to the new array. You must then discard the storage allocated to the old array. Even though working with arrays of changing size can be a challenge, many programmers select this method for its simplicity. There are other ways to manage rapidly changing sizes for a collection, but the straight-forward features provided by arrays make for a quick and easily understood implementation. 01 - 03_Array_Bag_Design_Docum The name of this assignment is the name of the file that you should upload. You should not change it by adding a prefix, or suffix. This Design Document should consist of your thoughts and intentions in solving the problem for this module the "Bag." This implementation of the Bag will be a class that uses a template to represent the items stored in an array. Your class should contain an array, not a vector. You must select a size and dynamically allocate that amount of memory from the system heap. The default constructor should not allocate any memory for the array; only when an item is being inserted into the bag should allocation occur. 01-04- yxxx_cis033_workspace.ZIP Create a ZIP archive of your eclipse workspace directory. Your eclipse workspace directory should be named yxxx_cis033_workspace where the letter 'y' is the first letter of your first name, and 'xxxx' are the first four letters of your last name. Within this workspace you should have one directory for each module. Because you will be relationships between the code written for each module, to properly evaluate later projects I will need access to all the modules you have written up to that point. The numbers at the beginning of the archive name indicates which module, in this case module 01, and which assignment in that module assignment 02 the Zip archive fulfills. 01-02 The Bag ADT - Implementation - Using Arrays The array is a very useful data structure because any element can be accessed in constant time. This constant time is the same for any element whether it is the first in the array, element[0] or the last in the array element[N]. However the array requires that storage for all the elements be allocated before any of them can be used. If you don't know exactly how many elements you need you have to guess.. Working with arrays under conditions where you do not know the exact maximum number of elements required means that you may have to change the size. However once an array has been allocated, it is immutable meaning the size can't be changed. If your array needs to grow or shrink, you must allocate an array of the new size and copy elements from the old array to the new array. You must then discard the storage allocated to the old array. Even though working with arrays of changing size can be a challenge, many programmers select this method for its simplicity. There are other ways to manage rapidly changing sizes for a collection, but the straight-forward features provided by arrays make for a quick and easily understood implementation

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

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions