Question: in this assignment, you will implement a basic Queue using an array ( or list ) in your preferred programming language. You will also perform

in this assignment, you will implement a basic Queue using an array (or list) in your preferred
programming language. You will also perform a set of operations on the Queue to demonstrate
your understanding of the concept.
Instructions:
1. Queue Implementation (50 points):
- Implement a Queue class that supports the following operations:
- enqueue(element) : Adds an element to the end of the Queue.
- dequeue() : Removes and returns the element from the front of the Queue. If the Queue is
empty, return an appropriate message.
- peek() : Returns the element at the front of the Queue without removing it.
- is_empty() : Returns `True` if the Queue is empty, `False` otherwise.
- size() : Returns the number of elements in the Queue.
2. Test Cases (30 points):
- Write a main function that performs the following:
1. Enqueue the elements 10,20,30, and 40 into the Queue.
2. Display the element at the front using the `peek()` method.
3. Dequeue two elements and display the elements dequeued.
4. Check if the Queue is empty.
5. Display the size of the Queue.
6. Continue dequeuing all elements until the Queue is empty.
7. Attempt to dequeue from an empty Queue and display the resulting message.
3. Code Structure and Comments (10 points):
- Ensure that your code is well-structured and contains comments explaining key parts of your
implementation.
4. Extra Credit (Optional -10 points):
- Modify your Queue implementation to allow a circular queue with a fixed size. Provide
additional operations:
- is_full() : Returns `True` if the Queue is full, `False` otherwise.
- Adjust `enqueue()` and `dequeue()` to support the circular queue behavior.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!