Answer:
The codes for the respective blanks are given below with appropriate comments for better understanding
Explanation:
FOR 1 TO 4
Void StackType::Push(ItemType item)
{
if(top == MAX_STACK - 1) // means stack is full so we need to throw the PushOnFullStack exception
throw PushOnFullStack ; // You can use this class and appropriate method to deal with exception like printing that stack is full so can not push the current item
top ++ ;// increment the top to accumulate the next item
items[top] = item; // put the item into the place identified
}
FOR 5 AND 6
Void Quetype::enqueue(itemType item)
{
if (rear==MAX_QUEUE && front==0) // queue is full so can not enqueue
//Handle the queue full exception here, may be print this
}else
{
items[rear] = item;
rear ++;
}