Define a class Repeat which allows the user to add elements from one end (rear) and remove elements from the other end (front) only.
The following details of the class Repeat are given below: Class name:
Repeat Data Members/instance variables:
st[]: an array to hold a maximum of 100 integer elements
cap: stores the capacity of the array
f: to point the index of the front
r: to point the index of the rear
Member functions:
Repeat (int m): constructor to initialize the data members cap = m, f = 0, r = 0 and to create the integer array
void pushvalue (int v): to add integer from the rear index if possible else display the message (“OVERFLOW”)
int popvalue (): to remove and return element from the front.
If array is empty then return -9999
void disp (): Displays the elements present in the list
(a) Specify the class Repeat giving details of the constructor (int), member function void pushvalue (int). int popvalue () and void disp ().
The main ( ) function need not be written.
(b) What is the common name of the entity described above?
(c) On what principle does this entity work?