1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
skad [1K]
2 years ago
14

Examine the following declarations and definitions for the array-based implementations for the Stack and Queue ADTs. Assume that

exception class PushOnFullStack and class PopOnEmptyStack have been defined and are available. Read the following code segment and fill in blank #6.
class StackType
{

public:

StackType();

void Push(StackItemType item);

void Pop();

private:

int top;

ItemType items[MAX_STACK];

};

void StackType::StackType()

{

top = -1;

}

void StackType::Push(ItemType item)

{

__________________ // 1

___________________; // 2

__________________; // 3

___________________; // 4

}

class QueType

{

public:

// prototypes of QueType operations

// go here

private:

int front;

int rear;

ItemType items[MAX_QUEUE];

}

void QueType::QueType()

{

front = MAX_QUEUE - 1;

rear = MAX_QUEUE - 1;

}

Boolean QueType::IsEmpty()

{

return (rear == front);

}

void QueType::Enqueue(ItemType item)

{

____________________; // 5

____________________; // 6

}

[1] rear = (rear +1) % MAX_QUEUE
[2] items[rear] = item
[3] rear = (rear % MAX_QUEUE) + 1
[4] items[front] = item
Computers and Technology
1 answer:
otez555 [7]2 years ago
8 0

Answer:

The codes for the respective blanks are given below with appropriate comments for better understanding

Explanation:

<u>FOR 1 TO 4</u>

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

}

<u>FOR 5 AND 6</u>

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 ++;

}

You might be interested in
There are information that are in the web view source that may not appear on the web page such as meta name. In addition there c
SCORPION-xisa [38]

Answer:

True on a web page such meta name will not appear in web view source and irrelevant information will be displayed.

Explanation:

Basically web page source is compiled version of HTML script so the end-user he or she tries to view pages system will show only in HTML.

so meta name information and active object information will not be displayed while viewing the web source code instead of that the irrelevant informant ions will be displayed and end-user cannot under anything out of the web source code.

Moreover, even the client side validation script also will not be displayed.

Only HTML will be displayed  

3 0
3 years ago
You're researching information about titanium bike frames. Which Web site is probably the least biased? The web site of a nation
Alexxx [7]
The website of a National Bike Museum would give you information about all different kinds of bikes. 

A local Bike shop would likely be biased to try to get you to buy from them. 

Answer) The website of a National Bike Museum 
5 0
3 years ago
If you have related data stored in multiple tables, create a(n) ________ to produce a pivottable on the combined data.
vladimir1956 [14]
If you have related data stored in multiple tables, create a Data model to<span> produce a pivot table on the combined data.
In computer term, data model refers to how each data are connected to one another and how those connections are being processed within the Sysyem</span>
3 0
3 years ago
Given that a function receives three parameters a, b, c, of type double, write some code, to be included as part of the function
never [62]

Answer:

Following are the code in the C Programming Language.

if(a==0) //set if conditional statement

{

//print the following message

printf("no solution for a=0");

}

Explanation:

Here, we define a function and pass three double data type variable i.e., "a", "b", "c" and then we write the following code inside the function.

  • Set the if conditional statement and check that condition is the variable "a" is equal to 0.
  • Then print message through the "printf()" which display on the screen if the given condition is true.
3 0
3 years ago
Convert 2910 to binary, hexadecimal and octal. Convert 5810 to binary, hexadecimal and octal. Convert E316 to binary, decimal an
Burka [1]

Answer:

2910 to binary = 101101011110

2910 to hexadecimal = B5E

2910 to octal = 5536

E316 to binary = 1110001100010110

E316 to octal = 161426

E316 to decimal = 58134

5916 to binary = 101100100010110

5916 to decimal = 22806

5916 to octal = 54426

010010102 to decimal = 149

010010102 to octal = 225

010010102 to hexadecimal = 95

FOR 438 and 618, 8 is not a valid digit for octal..

5 0
3 years ago
Other questions:
  • The this reference . a) can be used implicitly b) must be used implicitly c) must not be used implicitly d) must not be used 25)
    11·1 answer
  • show how one version of the technology is an improvement over a previous iteration of that same technology
    11·1 answer
  • You are going to be installing a videoconferencing system. One of the requirements of the system is that only workstations that
    10·1 answer
  • If a computer is found to have an ip address of 169.254.1.1, what can you assume about how it received that ip address?
    11·1 answer
  • What is the maximum upload speed you can get on an isdl internet connection?
    9·1 answer
  • Kelvin owns a small trading firm. Recently, he suspected that some of his employees were using fraudulent activities for their p
    5·2 answers
  • a. Fill in the blanks with suitable words: A software that controls and manages all the activities of the computer ... b. A soft
    13·1 answer
  • In 5-10 sentences, describe the procedure for responding to an e-mail message.
    5·1 answer
  • Where does Reiner take eren after they have a fight?
    7·2 answers
  • Professional communication must be objective,
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!