public class QueueOfInts { ListOfInts list; public QueueOfInts() { list = new ListOfInts(); } public boolean isEmpty() { return list.isEmpty(); } public void enqueue(int n) { list.append(n); } public int dequeue() { if (isEmpty()) throw new Error("Stack underflow"); list.reset(); int ans = list.getItem(); list.delete(); return ans; } }