Implement the following generic queue using exactly two Stac…

Questions

Implement the fоllоwing generic queue using exаctly twо Stаck objects. public clаss TwoStackQueue {    private final Stack in = new Stack();    private final Stack out = new Stack();    private int size;    public void offer(E item) { /* complete */ }//enqueue    public E poll() { /* complete */ }//dequeue    public E peek() { /* complete */ }    public int size() { /* complete */ }    public boolean isEmpty() { /* complete */ }} (a) Complete the class. poll() and peek() must throw NoSuchElementException when the queue is empty. Elements should be transferred between stacks only when necessary. [9 pts] (b) Explain why the implementation is FIFO even though each internal structure is LIFO. [2 pts] (c) Give the worst-case time of each operation. [4 pts]