TestListe.java
01 package fr.isae.bank;
02 
03 import java.util.ArrayList;
04 
05 /**
06  <code>TestTableau</code> construit une liste de comptes simples et
07  * n'affiche que les comptes courants.
08  *
09  @author <a href="mailto:garion@isae.fr">Christophe Garion</a>
10  @version 1.0
11  */
12 public class TestListe {
13 
14     /**
15      * Un programme creant une liste de comptes.
16      *
17      @param args non utilise ici
18      */
19     public static void main(String[] args) {
20         ArrayList<CompteSimple> l = new ArrayList<CompteSimple>();
21 
22         Personne p1 = new Personne("Xavier""Cregut"true);
23         Personne p2 = new Personne("Christophe""Garion"true);
24 
25         l.add(new CompteCourant(p1, 1000));
26         l.add(new CompteSimple(p2));
27         l.add(new CompteSimple(p1, 500));
28         l.add(new CompteCourant(p2, 1000));
29         l.add(new CompteCourant(p1, 500));
30 
31         (l.get(0)).crediter(300);
32         (l.get(1)).debiter(100);
33         (l.get(3)).debiter(200);
34 
35         for (CompteSimple cs : l) {
36             if (cs instanceof CompteCourant) {
37                 ((CompteCourantcs).editerReleve();
38                 System.out.println();
39             }
40         }
41     }
42 }