Question: Compilers use stacks to check whether or not the parentheses, square, and curly brackets are balanced (for every open there is a matching close) in

Compilers use stacks to check whether or not the parentheses, square, and curly brackets are balanced (for every open there is a matching close) in code. You will replicate this with your group by creating a Stack (using an ArrayList) and using the Stack to test whether the brackets and parentheses in a String are balanced. Methods: 1. 2. 3. 4. Push - add to your stack. Pop - remove from your stack and retum what was removed. Peek return the first element in your list without removing it CheckBalance - take in a String as a parameter and return either true (if the String has balanced symbols) or false (if the String doesn't have balance symbols). These checks should be done using your Push(), Pop(), and Peek(). You should handle []. O, and { } pairs and can safely ignore all other characters Make sure to account for all edge cases with your code. 5. Main - get a String from the user and send that String to the CheckBalance() then print either "Success!" or "Failure!" depending on the result from the method. Remember to comment your work with your name, the date, and a general description of the program at the top of each of your files. You should also put appropriate comments in the code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
