Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to code lab? Lab Goal : This lab was designed to teach you more about stacks. Lab Description : Read in a group of

How to code lab?

image text in transcribedimage text in transcribedimage text in transcribed
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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions