Need help with this Java problems. Java files are attached. Add your code to the file ArrayStack2Lab.java. Add your tests to the main() method. Submit ArrayStack2Lab.java. Problem 1 Implement the method public void display() which displays the entries in a stack starting from the top. If the stack is empty, print “The stack is empty”. Add the method to ArrrayStack2Lab.java. You do not need to modify StackInterface.java. Problem 2 Implement the method public int remove(int n) The method removes the n top most entries for a stack . If the stack contains less than n items, the stack becomes empty. The method returns the number of items removed. Add the method to ArrrayStack2Lab.java. You do not need to modify StackInterface.java.
Need help with this Java problems. Java files are attached.
Add your code to the file ArrayStack2Lab.java.
Add your tests to the main() method.
Submit ArrayStack2Lab.java.
Problem 1
Implement the method
public void display()
which displays the entries in a stack starting from the top. If the stack is empty, print “The stack
is empty”.
Add the method to ArrrayStack2Lab.java. You do not need to modify StackInterface.java.
Problem 2
Implement the method
public int remove(int n)
The method removes the n top most entries for a stack . If the stack contains less than n items,
the stack becomes empty. The method returns the number of items removed.
Add the method to ArrrayStack2Lab.java. You do not need to modify StackInterface.java.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images