Reference no: EM132136008
STACK - java, plz use simple java language, netbeans 8.1 or 8.2
1. Create a Stack class based on MyLinkedList class. Use this class in the following:
2. Create a new Java Application that has the following methods:
1. A method to generate a number of elements between two given values and save them in a stack.
2. A method to print a stack (10 elements per line). The original stack should remain as is after the print.
3. A method to return the number of elements on the stack.
4. A method to return if the stack is empty or not.
5. A method to search for a value in a stack. The stack should remain the same after the search is finished.
6. A method to print the second element of the stack and leave the original stack unchanged
7. A method to count the number of elements in a stack that are larger than a given value and leave the original stack unchanged.
8. A method peekLowestElement to return the smallest element. The original stack should remain unchanged.
9. A method peekHighestElement to return the largest element. The original stack should remain unchanged.
10. A method to inverse a stack.
11. A method to make a copy of a stack into another stack
• In the main method test all your methods including the following cases:
! Create 3 Stacks S1, S2, S3
! Insert 20 integers between 20 and 60 (do not insert duplicates) into S1
! Insert 30 integers between 10 and 80 (do not insert duplicates) into S2.