How to code lab?
Lab Goal : This lab was designed to teach you more about stacks. Lab Description : Read in a group of symbols and check to see if the appropriate opening symbol correctly matches up with the appropriate closing symbol. The opening symbols are '{ (1 ". You must read in and analyze each group. If you were to read in { } , you would have a correct balance of opening and closing symbols. If you were to read in { [ }] , you would not have a correct balance of opening and closing symbols. Sample Data : E??? {*def) Files Needed :: [ [{}] SyntaxCheckerjava. {{$x}} SyntaxCheckRunner.java [one]
{three} (four) car(cdr[a) {bi i) car(cdr[a) {bi} Sample Output : (abc (*def) is incorrect. algorithm helg [H] 15 correcr' ' while there are more values in the expression [ is incorrect . { . get a value from the Input [{}] is correct. if you have an opening symbol push it on the stack {{ $x}} is correct . e|se if it is a dose symbo| . if the stack is not empty [one] {three} (four) 18 correct. pop a value car (0dr (a) (b, i) is incorrect. :hseeck for a match with the current close symbol car (cm: (a) (b, 3 is correct. stop the process and mark the expression as bad } make sure nothing is left in the stack // A+ Computer Science - www.apluscompsci.com //Name - //Date - //Class - //Lab import java.util.Stack; import static java.lang.System.*; public class SyntaxChecker private String exp; private Stack symbols; public SyntaxChecker() public SyntaxChecker(String s) public void setExpression(String s) public boolean checkExpression() return false; //write a toString// A+ Computer Science - www.apluscompsci.com //Name - //Date - //Class - //Lab import java.util.Stack; import static java.lang.System.*; public class SyntaxCheckRunner public static void main ( String args ) //add test cases