1
2
3
4
5
6
7
8
9
10class PiepTest {
11
12
13
14 public static
15 void main(String[] args) {
16 Piep p;
17
18 int n = 100;
19 int z = 7;
20 int b = 10;
21
22 try {
23 n = Integer.valueOf(args[0]).intValue();
24 } catch (Exception e) {}
25
26 try {
27 z = Integer.valueOf(args[1]).intValue();
28 } catch (Exception e) {}
29
30 try {
31 b = Integer.valueOf(args[2]).intValue();
32 } catch (Exception e) {}
33
34 p = new Piep(z,b);
35 test(p,n);
36 }
37
38
39
40 private static
41 void test(Piep p, int n) {
42 System.out.println
43 ("piep mit der Ziffer " + p.ziffer +
44 " zur Basis " + p.basis +
45 "\ndie ersten " + n + " Zahlen");
46
47 for ( int i = 0;
48 i < n;
49 ++i ) {
50
51 if ( i % p.basis == 0 )
52 System.out.println();
53
54 System.out.print( p.piep(i) ? 'p' : '-' );
55
56 }
57 System.out.println();
58 }
59
60
61
62}