COMPUTER SCIENCE -JAVA- 1.Implement the abstract data type Stack using an array. You may use the following declaration for a static stack: class Stack { int size; int top; int[] arr; }; The operations to be implemented include CreateStack(), PushStack(), PopStack(). 2.Write a corresponding JAVA program to test your stack implementation by asking the user to continuously push and pop integer values to and from the stack, respectively. 3.Write a Java method that reads a list of integers and when user enters (-1) key prints them in reverse order. This is a very simple method that creates a stack, reads a series of numbers and pushes them onto the stack. When the user keys end of file, the program pops the stack and prints the numbers in reverse order.
COMPUTER SCIENCE
-JAVA-
1.Implement the abstract data type Stack using an array. You may use the following declaration for a static stack:
class Stack
{
int size;
int top;
int[] arr;
};
The operations to be implemented include CreateStack(), PushStack(), PopStack().
2.Write a corresponding JAVA
3.Write a Java method that reads a list of integers and when user enters (-1) key prints them in reverse order. This is a very simple method that creates a stack, reads a series of numbers and pushes them onto the stack. When the user keys end of file, the program pops the stack and prints the numbers in reverse order.
Step by step
Solved in 3 steps with 2 images