1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| public class comptbancaire {
private int CIN ;
private String nom;
private String prenom;
private int numero_compte;
private float solde;
private int nb_de_transaction;
public comptbancaire (int CIN,String nom,String prenom, int numero_compte,float solde,int nb_de_transaction)
{ this.CIN=CIN;
this.nom=nom;
this.prenom=prenom;
this.numero_compte=numero_compte;
this.solde=solde;
this.nb_de_transaction=nb_de_transaction;}
public int getCIN()
{return(CIN);
}
public void setCIN(int CIN)
{ this.CIN=CIN;}
public String getnom()
{return(nom);
}
public void setnom(String nom)
{this.nom=nom;}
public String getprenom()
{return(prenom); }
public void setprenom(String prenom)
{this.prenom=prenom;}
public int getnumero_compte()
{ return(numero_compte);}
public void setnumero_compte(int numero_compte)
{this.numero_compte=numero_compte;}
public float solde()
{return solde;}
public void setsolde(float solde)
{this.solde=solde;}
public int getnb_de_transaction()
{return(nb_de_transaction);}
public void setnb_de_transaction(int nb_de_transaction)
{this.nb_de_transaction=nb_de_transaction;}
public float deposer (float m)
{solde=solde+m;
return(solde);}
public float retirer (float m)
{ if (solde<m) return(-1);
solde=solde-m;
return(solde);}
public void afficher()
{System.out.println("le CIN est "+CIN);
System.out.println("le nom est "+nom);
System.out.println("le prenom est "+prenom);
System.out.println("le numero de compte est "+numero_compte);
System.out.println("le solde est"+solde );
System.out.println("le nb de transaction"+nb_de_transaction);}
public static void main(String[]args)
{ comptbancaire[]Agence;
Agence =new comptbancaire[2];
Agence[0]=new comptbancaire(1234,"Edgar","pani",34,20000,2);
Agence[1]=new comptbancaire(1234,"daniel","tori",37,20067,4);
Agence[0].deposer(200);
Agence[1].retirer(300);
}
} |
Partager