Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

An input line consists of many characters (numbers, letters, blanks, etc) includ

ID: 3917661 • Letter: A

Question

An input line consists of many characters (numbers, letters, blanks, etc) including a number of different kinds of parentheses, for example ( [ { ) ] }. Write a Java program that will determine if the parentheses are balanced (ie match). For example, ( ( [ ] ) ) [ ] { [ ] } is balanced (all parentheses match) but this is not: ( [ { } ( ) ).
Your assignment is to input (or hard code) some Strings containing a number of brackets (with or without spaces in between—that’s up to you; you can use the 2 examples above – just assign them to 2 different String variables) and use the ArrayStack to solve the problem. . Remove all of the references to jsjf in the code.
As you process the input start producing an output string containing each symbol examined. If you encounter a problem, add that symbol to the output string and a message describing the problem.

Explanation / Answer

Following is the answer:

Stack1.java