Hi, i have this assignment to do and i dont really know what i have to do
could someone tell me what i have to do in simpler language
Here is the assignment:
Create a program which:
Implements a class called Queue: The class should contain an array of maxQ integers.
There should be two constructors:
One that takes no argument creates a Queue object of maxQ=100 values.
One that takes a parameter q and creates a Queue object of maxQ=q values.
Queue should also have:
a function/method add(int) by which a user can add an integer value to a Queue object.
a function/method take() by which a user can read from a Queue object the first integer that was entered into it. After being read the integer should not be in the queue anymore.
In the main():
create a Queue object of maxQ=20
keep on asking the user whether (s)he wants to 1) add integers to the queue; 2) take integers from the queue; 3) exit.
when the user is prompted for the choice above (s)he should also be shown how many integers are currently in the queue.
You may have 2 values stored inside class Queue:
start: the position of the first element that was entered
end: the position of the last element entered
When an element is added through add(int), end should advance by one. If this brings it past the end of the array, it should pan to the beginning.
When an element is taken through take():
if no element is in the queue, 0 should be returned and nothing else should happen
if the queue is not empty, the first element entered (the one at position start) should be returned, and start should advance by one. If this brings it past the end of the array, it should pan to the beginning.