modify  "DynamicStringArray.cpp" file to make the program output the correct output. PLEASE i only have to modify the " DynamicStringArray.cpp" code to make the program right. Please help me. BELOW ARE THE PROVIDED CODES IN ORDER TO COMPLETE IT: DynamicStringArray.cpp: // Write the implementation of every method of the class // DynamicStringArray defined in DynamicStringArray.h #include "DynamicStringArray .h" //default constructor DynamicStringArray ::DynamicStringArray (){ //write code body of DynamicStringArray () } int DynamicStringArray ::sizeIs(){ //write code body of sizeIs () } void DynamicStringArray ::addEntry (string str){ //write code body of addEntry () }; bool DynamicStringArray::deleteEntry (string str){ //write code body of deleteEntry () } string* DynamicStringArray::getEntry(int index){ //write code body of deleteEntry () } //destructor DynamicStringArray ::~DynamicStringArray (){ //write code body of ~DynamicStringArray () } void DynamicStringArray ::printDynamicArray(){ //write code body of printDynamicArray () }

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
icon
Related questions
Question

C++ programming language

Images attached are the task and targeted output.

I was asked to modify  "DynamicStringArray.cpp" file to make the program output the correct output.

PLEASE i only have to modify the " DynamicStringArray.cpp" code to make the program right. Please help me.

BELOW ARE THE PROVIDED CODES IN ORDER TO COMPLETE IT:

DynamicStringArray.cpp:

// Write the implementation of every method of the class
// DynamicStringArray defined in DynamicStringArray.h

#include "DynamicStringArray .h"

//default constructor
DynamicStringArray ::DynamicStringArray (){

//write code body of DynamicStringArray ()

}

int DynamicStringArray ::sizeIs(){
//write code body of sizeIs ()
}

void DynamicStringArray ::addEntry (string str){
//write code body of addEntry ()
};

bool DynamicStringArray::deleteEntry (string str){
//write code body of deleteEntry ()
}
string* DynamicStringArray::getEntry(int index){
//write code body of deleteEntry ()
}
//destructor
DynamicStringArray ::~DynamicStringArray (){
//write code body of ~DynamicStringArray ()
}

void DynamicStringArray ::printDynamicArray(){
//write code body of printDynamicArray ()

}

 

DynamicStringArray.h:

// Please do not change the this file !!!!!
//***********************************************//
#ifndef DYNAMICSTRINGARRAY _H
#define DYNAMICSTRINGARRAY _H
#include <iostream>
#include <string>
using namespace std;

class DynamicStringArray
{
public:
DynamicStringArray();
int sizeIs();
string* getDynamicArray ();
void addEntry (string);
bool deleteEntry (string);
string* getEntry(int );
~DynamicStringArray ();
void printDynamicArray();

private:
string *dynamicArray;
int size;
};

#endif // DYNAMICSTRINGARRAY _H

 

Main.cpp:

 

// Do not change the this main program !!!!!
//***********************************************//
#include "DynamicStringArray .h"
#include <iostream>
#include <string>
using namespace std;

int main()
{
int op;
string str;
DynamicStringArray List; //DynamicStringArray=NULL size=0
cout<<"------>>> choose an option from the menu <<<------"<<endl;

cout<<" 1.Add an entry to the list of string........"<<endl;
cout<<" 2.Delete an entry to the list of string....."<<endl;
cout<<" 3.Display the list entries.................."<<endl;
cout<<" 4.End Program..............................."<<endl;
do{
cout<<"\n >> Enter your option from the menu:";
cin>>op;
if(op<=0 || op>5) {
cout<<"Wrong choice. Try again!!"<<endl;
continue;
}
switch(op){
case 1:
cout<<" >>> Enter a string to add to the list: ";
cin>> str;
List.addEntry (str);
break;
case 2:
cout<<" >>> Enter a string to remove from the list: ";
cin>> str;
List.deleteEntry(str);
break;
case 3:
List.printDynamicArray();
break;
case 4:
break;
}

} while(op!=4);

cout<<"End of Program.Bye!";
return 0;
}

 

 

When the main.
срр
is
run, the program should present the
following input/output to the user:
->>> choose an option from the menu
1. Add an entry to the list of string..
2. Delete an entry to the list of string.
3.Display the list entries..
4. End Program....
<<<----
> Enter your option from the menu:1
>>> Enter a string to add to the list: live
>> Enter your option from the menu:1
>>> Enter a string to add to the list: nice
>> Enter your option from the menu:1
>>> Enter a string to add to the list: beautifull
> Enter your option from the menu:3
The list content:
live || nice || beautifull |
>> Enter your option from the menu:1
>> Enter a string to add to the list: enjoy
> Enter your option from the menu:3
The list content:
live || nice || beautifull || enjoy |
>> Enter your option from the menu:2
>> Enter a string to remove from the list: NICE
NICE is not in the list
> Enter your option from the menu:3
The list content:
| live || nice || beautifull || enjoy |
>> Enter your option from the menu:2
>>> Enter a string to remove from the list: nice
> Enter your option from the menu:3
The list content:
| live || beautifull || enjoy |
>> Enter your option from the menu:4
End of Program.Bye!
Transcribed Image Text:When the main. срр is run, the program should present the following input/output to the user: ->>> choose an option from the menu 1. Add an entry to the list of string.. 2. Delete an entry to the list of string. 3.Display the list entries.. 4. End Program.... <<<---- > Enter your option from the menu:1 >>> Enter a string to add to the list: live >> Enter your option from the menu:1 >>> Enter a string to add to the list: nice >> Enter your option from the menu:1 >>> Enter a string to add to the list: beautifull > Enter your option from the menu:3 The list content: live || nice || beautifull | >> Enter your option from the menu:1 >> Enter a string to add to the list: enjoy > Enter your option from the menu:3 The list content: live || nice || beautifull || enjoy | >> Enter your option from the menu:2 >> Enter a string to remove from the list: NICE NICE is not in the list > Enter your option from the menu:3 The list content: | live || nice || beautifull || enjoy | >> Enter your option from the menu:2 >>> Enter a string to remove from the list: nice > Enter your option from the menu:3 The list content: | live || beautifull || enjoy | >> Enter your option from the menu:4 End of Program.Bye!
One problem with dynamic arrays
is
that
the
is
created
once
array
using the new operator the size
might want
For example, you
to add or delete entries from the array. This project asks
cannot be changed.
you to create a
class called DynamicStringArray that includes member
functions that allow it.
The class should have the following private member variables
dynamicArray that references a dynamic array of type string.
size that holds the number of entries in the array.
The class should have the following public methods:
A default constructor that sets
the dynamic array
to
NULL
and
sets size to 0.
A function sizeIs that returns size.
function
named addEntry that
string
input.
element larger
А
takes
a
as
The
function should
create
new dynamic array one
a
than dynamicArray, copy all elements from dynamicArray into the
array,
add the
new string onto
the
end of
the
new
new
array,
increment
size,
delete
the
old dynamicArray
and
then
set
dynamicArray to the new array.
A function named deleteEntry that
takes
a string as input. The
function should search dynamicArray for the string. If not found,
it returns false.
If found, it creates
new dynamic array one
should copy all
delete dynamicArray ,
a
element smaller than dynamicArray.
It
elements
except the input string into the new array,
decrement size, and return true.
A
function
named getEntry that
takes
integer
input and
an
as
the
string at
index
in dynamicArray.
returns
that
It
should
return NULL if the index is out of dynamicArray's bounds.
A destructor that
frees up
the memory allocated to
the dynamic
array.
printDynamicArray ()
dynamicArray
that
displays
the
elements
of
the
Instructions:
You will be given 3 files:
DynamicStringArray.h
(Do not modify)
DynamicStringArray.cpp (to be competed)
main.cpp (Do not modify)
Transcribed Image Text:One problem with dynamic arrays is that the is created once array using the new operator the size might want For example, you to add or delete entries from the array. This project asks cannot be changed. you to create a class called DynamicStringArray that includes member functions that allow it. The class should have the following private member variables dynamicArray that references a dynamic array of type string. size that holds the number of entries in the array. The class should have the following public methods: A default constructor that sets the dynamic array to NULL and sets size to 0. A function sizeIs that returns size. function named addEntry that string input. element larger А takes a as The function should create new dynamic array one a than dynamicArray, copy all elements from dynamicArray into the array, add the new string onto the end of the new new array, increment size, delete the old dynamicArray and then set dynamicArray to the new array. A function named deleteEntry that takes a string as input. The function should search dynamicArray for the string. If not found, it returns false. If found, it creates new dynamic array one should copy all delete dynamicArray , a element smaller than dynamicArray. It elements except the input string into the new array, decrement size, and return true. A function named getEntry that takes integer input and an as the string at index in dynamicArray. returns that It should return NULL if the index is out of dynamicArray's bounds. A destructor that frees up the memory allocated to the dynamic array. printDynamicArray () dynamicArray that displays the elements of the Instructions: You will be given 3 files: DynamicStringArray.h (Do not modify) DynamicStringArray.cpp (to be competed) main.cpp (Do not modify)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Math class and its different methods
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
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education