Question: The current StackInterface has 5 methods; In addition to the 5 methods, A) I want you to add 2 additional methods as shown below: 1)

 The current StackInterface has 5 methods; In addition to the 5methods, A) I want you to add 2 additional methods as shownbelow: 1) firstDataEnteredis () : T This method returns the first element

The current StackInterface has 5 methods; In addition to the 5 methods, A) I want you to add 2 additional methods as shown below: 1) firstDataEnteredis () : T This method returns the first element that was added to the stack, ie. It returns the bottom of the stack, without removing it : if stack is empty then it returns null. Example, If we add items to the stack in the following order push ("CSIS210"), push ("MATH201"), push ("CHEM115"), Push("CSIS330" ) then if we call firstDataEnteredIs () it would return CSIS210 and stack remains unchanged. 2) find (T) :boolean This method returns true if T is in the stack otherwise it returns false Example, If we add items to the stack in the following order push ("CSIS210"), push ("MATH201") , push ("CHEM115"), Push ("CSIS330" ) then if we call find ("PHYS116") it would return false and if we call find ("CHEM115") it would return true. B) I want you to modify the class LinkedStack and rename it to LinkedStack2 so its implements the 2 new methods added in StackInterface C) Write a main method in class LinedStack2 to make sure both new methods work as they are supposed to, ie create a stack, add data to it then call the method and print what it should return and what it actually returns. Test method firstDataEnteredIs returns the correct data when stack has data and when stack is emptyialso test f ind with argument that is in the stack and with an argument not in the stack

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!