Yurttas/PL/OOL/Java/F/02/04/02/01/TA01.java

From ZCubes Wiki
Jump to navigation Jump to search
 1/**
 2 *  Copyright(C) 2004
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  date   : September 1, 2004.
11 *  author : Salih Yurttas.
12 */
13
14
15public class TA01 {
16
17  public static void main(String[] args) {
18    TA<Integer> o1 = new TA<Integer>(2,
19                                     2);
20    o1.output();
21
22    int n = o1.getSize0();
23
24    int[] ia = new int[n];
25
26    ia = o1.getA0();
27
28    for(int i=0; i<n; i++)
29      System.out.println(ia[i]);
30
31    System.out.println();
32
33    n = o1.getSize1();
34
35    ia = new int[n];
36
37    ia = o1.getA1();
38
39    for(int i=0; i<n; i++)
40      System.out.println(ia[i]);
41
42    System.out.println();
43
44    o1.setA0(5);
45    o1.setA1(8);
46
47    o1.output();
48
49    System.out.println();
50
51    TA<Double> o2 = new TA<Double>(2.0,
52                                   2.0);
53    o2.output();
54
55    n = o2.getSize0();
56
57    double[] da = new double[n];
58
59    da = o2.getA0();
60
61    for(int i=0; i<n; i++)
62      System.out.println(da[i]);
63
64    System.out.println();
65
66    n = o2.getSize1();
67
68    da = new double[n];
69
70    da = o2.getA1();
71
72    for(int i=0; i<n; i++)
73      System.out.println(da[i]);
74
75    System.out.println();
76
77    o2.setA0(5.0);
78    o2.setA1(8.0);
79
80    o2.output();
81  }
82
83}