Please create an Array Stack method that implements the Stack method given Create the generic ArrayStack that
Question:
Please create an Array Stack method that implements the Stack method given
Create the generic ArrayStack that implements the provided Stack interface using an array. 2. Create a driver class called Assign1PartB_Driver and any other classes/methods that you may require. You must use two stack objects to hold items that will restore the states based on the function (undo "z" or redo "y") selected. Allow the user to quit ("q") anytime
stack class
public interface Stack<E> {
/**
* Returns the number of elements in the stack.
* @return number of elements in the stack
*/
int size();
/**
* Tests whether the stack is empty.
* @return true if the stack is empty, false otherwise
*/
boolean isEmpty();
/**
* Inserts an element at the top of the stack.
* @param e the element to be inserted
*/
void push(E e);
/**
* Returns, but does not remove, the element at the top of the stack.
* @return top element in the stack (or null if empty)
*/
E top();
/**
* Removes and returns the top element from the stack.
* @return element removed (or null if empty)
*/
E pop();
}
. Create a program that simulates the undo/redo features of an application. Implement a simple calculator that asks the user for the basic arithmetic operation that they would like to perform on the last result. Your program will: - Prompt the user to enter an initial number (first operand) - Then - prompt the user for the next operator and second operand - evaluate the expression - present the user with the result, which will be the new first operand - This will continue until the user chooses to quit, or undo (redo) an operation The undo operation restores the last state. The redo operation restores the next state if an undo was previously performed.
Practical Introduction To Data Structures And Algorithm Analysis Java Edition
ISBN: 9780136609117
1st Edition
Authors: Clifford A. Shaffer