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

c++ 1. What is the effect of the following statement? If a statement is invalid,

ID: 3632128 • Letter: C

Question

c++

1. What is the effect of the following statement? If a statement is invalid, explain why it is invalid. The classes queueADT, queueADT, and linkedQueueType are as defined in this chapter.
a) queueADT<int> newQueue;
b) queueType<double> sales(-10);
c) queueType<string> names;
d) linkedQueueType<int> numQueue(50);

2. What is the output of the following program segment?
linkedQueueType<int> queue;

queue.addQueue(10);
queue.addQueue(20);
cout << queue.front() << endl;
queue.deleteQueue();
queue.addQueue(2 * queue.back());
queue.addQueue(queue.front());
queue.addQueue(5);
queue.addQueue(queue.back() – 2);

linkedQueueType<int> tempQueue;

tempQueue = queue;

while (!tempQueue.isEmptyQueue())
{
cout << tempQueue.front() << “ “;
tempQueue.deleteQueue();
}
cout << endl;
please show steps

Explanation / Answer

1) a) queueADT newQueue; --> creates a queue of type int b) queueType sales(-10); --> invalid negative size c) queueType names; --> queueType is string and will hold names d) linkedQueueType numQueue(50); --> linked list of ints of size 50 2) we know front Access next element (public member function) back Access last element (public member function) .....soooo linkedQueueType queue; --> create queue queue.addQueue(10); --> holds 10 queue.addQueue(20); --> holds 10 20 cout holds 0 0 queue.addQueue(5); --> holds 0 0 5 queue.addQueue(queue.back() – 2); --> holds 0 0 5 3 linkedQueueType tempQueue; tempQueue = queue; while (!tempQueue.isEmptyQueue()) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote