Question: Implement the method reverseString in Lab 5 Tester according to the documentation provided. Make sure to write additional tests to ensure your implementation is correct.
Implement the method reverseString in LabTester according to the documentation provided.
Make sure to write additional tests to ensure your implementation is correct. You MUST use a stack
in your implementation
public class LabTester
private static int testPassCount ;
private static int testCount ;
public static void main String args
try
testBasicStack;
testStackUseFunctions;
testQueue;
catch Exception e
System.out.printlnYour code threw an Exception.";
System.out.printlnPerhaps a stack trace will help:";
eprintStackTraceSystemout;
System.out.printlnPassed testPassCount testCount tests";
Purpose: reverses given string following this algorithm
pushes each character in str onto a new stack
creates a new empty result String
pops each character off the Stack adding it to the result String
returns the result String
Parameters: String str the String to reverse
Returns: String the reversed result String
public static String reverseStringString str
Stack stk new StackArrayBased;
String result ;
TODO: complete the implementation
return result;
Purpose: determines whether every has a matching
found later in the string. Any that does not
have a preceding means the brackets do not match
Parameters: String str the String to check for a bracket match
Returns: boolean true if brackets are matched, false otherwise
public static boolean doBracketsMatchString str
Stack stk new StackArrayBased;
TODO: complete the implementation
return false; so it compiles
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
