Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can anyone help me out. 1 of 2 La b 2- Fixed Size Sequence Class Implement a fixed size container class that encapsulates a statically

Can anyone help me out.
image text in transcribed
1 of 2 La b 2- Fixed Size Sequence Class Implement a fixed size container class that encapsulates a statically sized array and test it using a suitable driver program (break the program into 3 files- definition, implementation and driver). Use a typedef statement to create a synonym for the instance variable's (the array) data type to make your code more flexible (see the PlainBox class in Chapter 3). Test your program with an array of ints and an array of doubles (you should only have to make one change in the typodef statement to do this). Your class should include the following data members: An array (of size 10 by default) A variable to hold the array capacity (capacity). A variable to keep track of the number of elements currently being used (num used) The detault constructor initializes capacity to 10 and num used to 0 Include functions to: Determine if the array is full (return a bool value) Determine if the array is empty (return a bool valuc) Return the array capacity Return the number of elements currently being used Additional member functions: .A one argument function to return an element at a given position (get) .A two argument function to overwrite an element at a given position (set) . A one argument function to add a given element to the array at the nextavailable .A funetion to return the position of an element passed as an argument. Return a -I .Add a method to insert an element at a given position. The method will make . Add a method to delete an element at a given position. The method will move location. (at the back) if not found. room for the new element by moving elements over elements over to close the gap and overwrite the element. Note: Make sure you check for out of bounds conditions and the cases when the array is full Your driver program should declare an array object, input values from the keyboard; manipulate the array elements by making calls to get, set and add; test the full, empty and array capacity methods; and print the contents of the partially filled array after the initial input and after all the manipulations are performed. The main method should implement a menu system with a quit option so the user can make selections for add, set, get, etc

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_2

Step: 3

blur-text-image_3

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

Database And Expert Systems Applications Dexa 2023 Workshops 34th International Conference Dexa 2023 Penang Malaysia August 28 30 2023 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Maqbool Khan

1st Edition

303139688X, 978-3031396885

More Books

Students also viewed these Databases questions