Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

tempQueue.createQueue(); // dequeue all items from aQueue, print them, and store

ID: 3531732 • Letter: T

Question

tempQueue.createQueue();

// dequeue all items from aQueue, print them, and store them in

// tempQueue

while (!aQueue.isEmpty()){

aQueue.dequeue(x)

cout << x << " "

tempQueue.enqueue(x)

}out << endl;

// put items back into aQueue

while (!tempQueue.isEmpty()){

tempQueue.dequeue(x)

aQueue.enqueue(x)

}

tempQueue.destroyQueue()

//////////////////////////////////////////////////////

////////////////////////////////////////////////////

void Queue::display() const{

for (QueueNode* tempPtr = frontPtr;

tempPtr != NULL;

tempPtr = tempPtr->next)

cout << tempPtr->item << " ";

cout << endl;

}


I need to convert this code to a javapseudocode!!!???

Explanation / Answer

tempQueue.createQueue();

// dequeue all items from aQueue, print them, and store them in

// tempQueue

while (!aQueue.isEmpty()){

aQueue.dequeue(x)

System.out.println(x);

tempQueue.enqueue(x)

}

System.out.println();

// put items back into aQueue

while (!tempQueue.isEmpty()){

tempQueue.dequeue(x)

aQueue.enqueue(x)

}

tempQueue.destroyQueue()

//////////////////////////////////////////////////////

////////////////////////////////////////////////////

void Queue::display() const{

for (QueueNode* tempPtr = frontPtr;

tempPtr != NULL;

tempPtr = tempPtr->next)

System.out.println(tempPtr.item);

System.out.println();

}