/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ /** * @author Uwe Schmidt * * Hauptprogramm zum Testen des Abzaehlspiels * piep,1,2,3,4,5,6,piep,8,9,10,11,12,13,piep,15,piep,piep,18 */ //-------------------- class PiepTest { //-------------------- public static void main(String[] args) { Piep p; int n = 100; int z = 7; int b = 10; try { n = Integer.valueOf(args[0]).intValue(); } catch (Exception e) {} try { z = Integer.valueOf(args[1]).intValue(); } catch (Exception e) {} try { b = Integer.valueOf(args[2]).intValue(); } catch (Exception e) {} p = new Piep(z,b); test(p,n); } //-------------------- private static void test(Piep p, int n) { System.out.println ("piep mit der Ziffer " + p.ziffer + " zur Basis " + p.basis + "\ndie ersten " + n + " Zahlen"); for ( int i = 0; i < n; ++i ) { if ( i % p.basis == 0 ) System.out.println(); System.out.print( p.piep(i) ? 'p' : '-' ); } System.out.println(); } //-------------------- } // Ende class Pieptest