import java.util.ArrayList;
public class Banque {
	private ArrayList<Personne> lesClients;
	private ArrayList<CompteEnBanque> lesComptes;
	public Banque(){
		 lesClients = new ArrayList<Personne>();
		 lesComptes = new ArrayList<CompteEnBanque>();
	}
	public void creerClient(String n, String p){
		lesClients.add(new Personne(n,p));
	}
	public void creerCompteCourant(String n, Personne p){
		CompteCourant c = new CompteCourant(n,p);
		p.ouvreCompte(c);
		lesComptes.add(c);
	}
	public void creerCompteEpargne(String n, Personne p, double pr){
		CompteEpargne c = new CompteEpargne(n,p,pr);
		p.ouvreCompte(c);
		lesComptes.add(c);
	}
	public void afficheClients(){
		for(int i=0;i<lesClients.size();i++)
			lesClients.get(i).afficheToi();
	}
	public void afficheComptes(){
		for(int i=0;i<lesComptes.size();i++)
			lesComptes.get(i).afficheToi();
	}
	public void job(){
		this.creerClient("Van Zee", "Nicolas");
		this.creerClient("Philemotte", "Christophe");
		this.creerClient("Bersini", "Hugues");
		this.creerCompteCourant("1234",lesClients.get(0));
		this.creerCompteEpargne("2345",lesClients.get(1),0.5);
		this.creerCompteCourant("3456",lesClients.get(2));
		this.creerCompteEpargne("4567",lesClients.get(1),1);
		this.afficheClients();
		this.afficheComptes();
		for(int i=0;i<lesComptes.size();i++){
			lesComptes.get(i).depot(Math.random()*1500);
			lesComptes.get(i).retrait(Math.random()*1500);
			lesComptes.get(i).calculInteret();
		}
		this.afficheComptes();
		CompteCourant cc = (CompteCourant) lesComptes.get(0);
		cc.virement(350,lesComptes.get(1));
		this.afficheClients();
	}
}