All pastes #926998 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-03-03 23:14 UTC
rendered paste body
	public static void main(String[] args) {
		//consider using this main() for testing

		BookProblemsPS10 bookprobs = new BookProblemsPS10();

		if ( bookprobs.ex2a("abc*") ) {
			System.out.print("ex2a test #1 PASSED \t");
		} else {
			System.out.print("ex2a test #1 FAILED \t");
		}

		if ( bookprobs.ex2a("abc") ) { //no * on end, should return false
			System.out.print("ex2a test #2 FAILED \t");
		} else {
			System.out.print("ex2a test #2 PASSED \t");
		}

		if ( bookprobs.ex2a("") ) { //empty str, should return false
			System.out.println("ex2a test #3 FAILED \t");
		} else {
			System.out.println("ex2a test #3 PASSED \t");
		}
		
		if ( bookprobs.ex2b("") ) { //empty str, should return false
			System.out.print("ex2b test #1 FAILED \t");
		} else {
			System.out.print("ex2b test #1 PASSED \t");
		}
		
		if ( bookprobs.ex2b("RAWR") ) { //string without **, should return false
			System.out.print("ex2b test #2 FAILED \t");
		} else {
			System.out.print("ex2b test #2 PASSED \t");
		}
		
		if ( bookprobs.ex2b("RAWR**") ) { //string with **, should return true
			System.out.println("ex2b test #3 PASSED \t");
		} else {
			System.out.println("ex2b test #3 FAILED \t");
		}
		
		
		
		
		if ( bookprobs.ex3SSNSanitize("654-65-6548").equals("654656548")) {
			System.out.print("ex3a test #1 PASSED \t");
		} else {
			System.out.print("ex3a test #1 FAILED \t");
		}

		if ( bookprobs.ex3SSNSanitize("as").equals("as")) {
			System.out.print("ex3a test #2 PASSED \t");
		} else {
			System.out.print("ex3a test #2 FAILED \t");
		}

		if ( bookprobs.ex3SSNSanitize("").equals("")) {
			System.out.println("ex3a test #3 PASSED \t");
		} else {
			System.out.println("ex3a test #3 FAILED \t");
		}
		
		
		
		if ( bookprobs.ex4aDateReformat("09/07/1990").equals("07-09-1990")) {
			System.out.print("ex4a test #1 PASSED \t");
		} else {
			System.out.print("ex4a test #1 FAILED \t");
		}

		if ( bookprobs.ex4aDateReformat("as").equals("as")) {
			System.out.print("ex4a test #2 PASSED \t");
		} else {
			System.out.print("ex4a test #2 FAILED \t");
		}

		if ( bookprobs.ex4aDateReformat("").equals("")) {
			System.out.println("ex4a test #3 PASSED \t");
		} else {
			System.out.println("ex4a test #3 FAILED \t");
		}
		
		

		if ( bookprobs.ex5aLastFour("1234 1234 1234 1234").equals("1234")) {
			System.out.print("ex5a test #1 PASSED \t");
		} else {
			System.out.print("ex5a test #1 FAILED \t");
		}

		if ( bookprobs.ex5aLastFour("as").equals("as")) {
			System.out.print("ex5a test #2 PASSED \t");
		} else {
			System.out.print("ex5a test #2 FAILED \t");
		}

		if ( bookprobs.ex5aLastFour("").equals("")) {
			System.out.println("ex5a test #3 PASSED \t");
		} else {
			System.out.println("ex5a test #3 FAILED \t");
		}

		
		if ( bookprobs.ex5bLastFive("1234 1234 1234 1234").equals("41234")) {
			System.out.print("ex5b test #1 PASSED \t");
		} else {
			System.out.print("ex5b test #1 FAILED \t");
		}

		if ( bookprobs.ex5bLastFive("12345").equals("12345")) {
			System.out.print("ex5b test #2 PASSED \t");
		} else {
			System.out.print("ex5b test #2 FAILED \t");
		}

		if ( bookprobs.ex5bLastFive("").equals("")) {
			System.out.println("ex5b test #3 PASSED \t");
		} else {
			System.out.println("ex5b test #3 FAILED \t");
		}