Question: need a java code for this program the StackInterface created in Lab3, define a class LinkedStack that implements hods and creates an inner class Node.

the StackInterface created in Lab3, define a class LinkedStack that implements hods and creates an inner class Node. java.util.EmptyStackException; ablic class linkedStack T implements StackInterface T{ private Node topNode; // References the first node in the chain public LinkedStack () i topNode = null: 1 Qoverride public void push (T newEntry) I Node newNode = new Node (newEntry, topNode); topNode = newNode; 1 eoverride public T pop () 1 T top = peek () ; topNode = topNode get NextNode() ; return top: 1 eoverride public T peek() I if (isEmpty ()) throw now Emptysta Exception (1): else publie ? pop 0 I top = peek O: 1/ Might throw EmptystackException topNode = topNode. getNextNode () ; return top: publie boolean iskmptyo return topNode -. nu11; publie void elear() topliode = null: fl Cautea doallocation of noden in the chaln private elaale Node I 2. By midnight, 'Tuesday, Februar private T datai ll Retry in stack 14th, submit your Java source fil private Node next: II link ta next node: (Main.Java) and a sereenshot of private Node (I dataportion) I the execution result via this (datafortion, nu11): 'Lab4 - Ch6 Stacks' under the 1 'Submit Lab Assignments' menu private Node (T datapurtion, Node Iinkportion) I in the course Blackboard. At the beginning of the code, add a 1 heading with your name, a date submitted, and a brief description pilvate T gotbata () i about the assignment, and i) return datad appropriate comments in the body. Private Node getNextNode () ( return next; I 11 and Node 3. Write java tester code to find the contents of the myStack after the following statements are completed and executed. public mtatic void maja (Etring[] arqa) 1 (f) puis ouitim to myit tack. fipush "jeation to nyy not at k. f puste wi 11= to nyefiat (f puat " Hoe" Co 6 py3nack ff unc,ili the it tace in nasity (1) puils wsin' toi nrat ack fustaciar tion atace
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
