/* Implements a stack of real numbers (doubles). * The maximum number of elements allowed in the stack is given by MAX_SIZE. */ public class DoubleStack { // Default constructor public DoubleStack() { data = new double[MAX_SIZE]; topIndex = -1; } public boolean isEmpty() { if (topIndex == -1) { return true; } else { return false; } } public boolean isFull() { if (topIndex == MAX_SIZE - 1) { return true; } else { return false; } } public void popAll() { topIndex = -1; } // Push the number "x" onto the top of the stack. public void push(double x) { topIndex++; data[topIndex] = x; } // Return the top element of the stack. public double top() { // Modify code here return 0.0; } // Remove the top element from the stack. public void pop() { // Modify code here } private double[] data; private int topIndex; private static final int MAX_SIZE = 1000000; }