/* * Main.java * * Created: March 14, 2005 * By: Stan Sclaroff * Description: Main class to help test methods developed for * CS111 Spring 05 Programming Assignment 6 * */ package program6; public class Main { /** Creates a new instance of Main */ public Main() { } /** * @param args the command line arguments */ public static void main(String[] args) { // Test strings for Program Assignment 6 String test[] = { "[{}([][])]", "[{()}{}{}]", "", "()()([{}]))", "{{{}{}}[([([()])])]}", "[[[[[[[", "{[]{{}}}{}][", "{{{{{[][][()]}}}}}", "][", "()" }; boolean balanced[] = {true,true,true,false,true, false,false,true,false,true}; for(int i = 0; i < test.length; ++i) { boolean v = Nested.isBalanced(test[i]); System.out.println("\"" + test[i] + "\" is " + ((balanced[i] == false) ? "not " : "") + "balanced" ); System.out.println("Your method isBalanced reports: " + ((v == false) ? "not " : "") + "balanced" ); } } }