Vous êtes sur la page 1sur 8

///////////////////////////////////////////////////////////// /////// CLASSE : personne.

java /////// ///////////////////////////////////////////////////////////// public class personne { private int code,anne_naiss,nb_enf; protected String nom, prenom; private String adresse; private boolean mari; public personne (int code,int anne_naiss,String nom, String prenom,String adresse){ if(code>0) this.code=code; this.adresse=adresse; this.anne_naiss=anne_naiss; this.nom=nom; this.prenom=prenom; this.mari=false; this.nb_enf=0; } public personne(int code,int anne_naiss,String nom, String prenom,String adresse,int nb_enf,boolean mari){ if(code>0) this.code=code; this.adresse=adresse; this.anne_naiss=anne_naiss; this.nom=nom; this.prenom=prenom; this.nb_enf=nb_enf; this.mari=mari; } public int getcode(){ return code;} public void setcode(int code){ if(code>0) this.code=code;} public int getanne_naiss(){ return anne_naiss;} public void setanne_naiss(int anne_naiss){ this.anne_naiss=anne_naiss;} public int getnb_enfants(){ return nb_enf;} public void setnb_enfants(int nb_enfants){ this.nb_enf=nb_enfants;} 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 String getadresse(){ return adresse;} public void setadresse(String adresse){ this.adresse=adresse;} public boolean getmari(){ return mari;} public void setmari(boolean mari){ this.mari=mari;}
1

Master1 : Suret de fonctionnement 2011/2012

Fait par : TABET ANIS

Encadreur : Mr REFFAD

public int age(){ return 2012-anne_naiss;}public void afficherpersonnesmari() { if (getmari()==true) System.out.println("nom : "+nom+"_______ prenom : "+prenom+" Situation : Mari "+mari+"______ nbr_enfants : "+nb_enf); } public void afficherpersonnescelib() { if (getmari()==false) System.out.println("nom : "+nom+"_______ prenom : "+prenom+" Situation : Clibataire "+"______ nbr enfants : pas d'enfants sois "+nb_enf+" enfant "); } public void afficherpersonnesplusag() { if (age()>30) age System.out.println("nom : "+nom+"_______ prenom : "+prenom+" : superieur a 30ans sois "+age()+" ans"); } public void afficherpersonnesmoinag() { if (age()<30) System.out.println("nom : "+nom+"_______ prenom : "+prenom+" age : inferieur a 30ans sois "+age()+" ans"); } } ////////////////////////////////////////////////////////////////////////// ////////// CLASSE : employ.java /////////// public class employ extends personne { private String prof,nom_entr; private int echelle,anne_recr; public employ(int code,int anne_naiss,String nom, String prenom,String adresse,int nb_enf,boolean mari,String prof,int echelle,int anne_recr,String nom_entr) { super( code, anne_naiss, nom, prenom,adresse, nb_enf, mari); if((echelle>=6)&&(echelle<=16)) this.prof=prof; this.echelle=echelle; this.anne_recr=anne_recr; this.nom_entr=nom_entr; } public employ(int code,int anne_naiss,String nom, String prenom,String adresse,String prof,int echelle,int anne_recr,String nom_entr) {super( code, anne_naiss, nom, prenom,adresse); if((echelle>=6)&&(echelle<=16)) this.prof=prof; this.echelle=echelle; this.anne_recr=anne_recr; this.nom_entr=nom_entr;} public int nb_anne(){ return 2012-anne_recr; } public String getprof(){ return prof;} public void setprof(String prof){ this.prof=prof;}
2

Master1 : Suret de fonctionnement 2011/2012

Fait par : TABET ANIS

Encadreur : Mr REFFAD

public int getechelle(){ return echelle;} public void setechelle(int echelle){ if((echelle>=6)&&(echelle<=16)) this.echelle=echelle;} public int getanne_recr(){ return anne_recr;} public void setanne_recr(int anne_recr){ this. anne_recr=anne_recr;} public String getnom_entr(){ return nom_entr; }

public float salaire(){ if (getmari()==true) return echelle*2+nb_anne()*500+getnb_enfants()*1000+2000; else return echelle*2+nb_anne()*500+1000; } public void salairemoin() { if (salaire()<28000) System.out.println("nom : "+nom+"_______ prenom : "+prenom+" salaire : inferieur a 28000 DA sois "+salaire()+" DA"); } public void salaireplus() { if (salaire()>28000) System.out.println("nom : "+nom+"_______ prenom : "+prenom+" salaire : superieur a 28000 DA sois "+salaire()+" DA"); } static static static public { float NKL = 480000000; float CDA = 15000000; float PLA = 200000000; void nomemploy()

if((nom_entr=="NKL")&&(NKL>300000000)) System.out.println("nom : "+nom+"_______ prenom : "+prenom+" l'employ travaille dans une entreprise ayant un chiffre d'affaire supperieur a 30M sois il travaille a " +nom_entr); if((nom_entr=="CDA")&&(CDA>300000000)) System.out.println("nom : "+nom+"_______ prenom : "+prenom+" l'employ travaille dans une entreprise ayant un chiffre d'affaire supperieur a 30M sois il travaille a " +nom_entr); if((nom_entr=="PLA")&&(PLA>300000000)) System.out.println("nom : "+nom+"_______ prenom : "+prenom+" l'employ travaille dans une entreprise ayant un chiffre d'affaire supperieur a 30M sois il travaille a " +nom_entr); } }

Master1 : Suret de fonctionnement 2011/2012

Fait par : TABET ANIS

Encadreur : Mr REFFAD

////////////////////////////////////////////////////////////////////////// /////////////// CLASSE : entreprise.java //////////////

/////////////////////////////////////////////////////////////////////////

public class entreprise { private String nom_entr; private float c_affaire; public entreprise(String nom_entr,float c_affaire){ this.nom_entr=nom_entr; this.c_affaire=c_affaire;} public String getnom_entr(){ return nom_entr; } public void setnom_entr(String nom_entr){ this.nom_entr=nom_entr; } public float getc_affaire(){ return c_affaire; } public void setc_affaire(float c_affaire){ this.c_affaire=c_affaire; } public void entreprisenom() { if(getc_affaire()>300000000) { System.out.println("nom de l'entreprise : "+nom_entr+"_______chiffre d'affaire de cette entreprise est: "+c_affaire); }

} }

Master1 : Suret de fonctionnement 2011/2012

Fait par : TABET ANIS

Encadreur : Mr REFFAD

/////////////////////////////////////////////////////////////////////////// ////////////// CLASSE : PRINCIPALE.java /////////////////

public class PRINCIPALE { public static void main(String[] args) { entreprise[] entreprise = new entreprise[3]; entreprise [0] =new entreprise("PLA",200000000); entreprise [1] =new entreprise("CDA",15000000); entreprise [2] =new entreprise("NKL",480000000); employ[] employ = new employ[10]; employ[0]=new employ(1,1990,"ANIS","TABET","Stif","Etudiant",16,2000,"NKL"); employ[1]=new employ(1,1991,"A","A","Stif",2,true,"ingenieur",13,1999,"NKL"); employ[2]=new employ(1,1992,"B","B","Stif","ingenieur",14,2009,"CDA"); employ[3]=new employ(1,1993,"C","C","Stif",4,true,"ingenieur",15,1995,"CDA"); employ[4]=new employ(1,1994,"D","D","Stif",2,true,"ingenieur",15,1995,"CDA"); employ[5]=new employ(1,1986,"E","E","Stif","ingenieur",10,1995,"CDA"); employ[6]=new employ(1,1981,"F","F","Stif",4,true,"ingenieur",10,1995,"CDA"); employ[7]=new employ(1,1980,"G","G","Stif",2,true,"ingenieur",10,1995,"PLA"); employ[8]=new employ(1,1980,"H","H","Stif","ingenieur",10,1995,"PLA"); employ[9]=new employ(1,1970,"I","I","Stif","ingenieur",7,1990,"NKL"); System.out.println("question 3 : employs celibataires "); int i ; for (i=0;i<10;i++) employ[i].afficherpersonnescelib(); System.out.println(" ");

System.out.println("question 3 ( suite ): employs maris "); int j ; for (j=0;j<10;j++) employ[j].afficherpersonnesmari(); System.out.println(" "); System.out.println("question 4 : employs plus age que 30 ans"); int k ; for (k=0;k<10;k++) employ[k].afficherpersonnesplusag(); System.out.println(" "); System.out.println("question 4 ( suite ) : employs moin ags de 30 ans"); int l ; for (l=0;l<10;l++) employ[l].afficherpersonnesmoinag(); System.out.println(" ");
5

Master1 : Suret de fonctionnement 2011/2012

Fait par : TABET ANIS

Encadreur : Mr REFFAD

System.out.println("question 5 : employs leurs salaire superieur a 28000 DA"); int m ; for (m=0;m<10;m++) employ[m].salaireplus(); System.out.println(" "); System.out.println("question 5 ( suite ) : employs leurs salaire inferieur a 28000 DA"); int n ; for (n=0;n<10;n++) employ[n].salairemoin(); System.out.println(" "); System.out.println("question 6 : condition pour que l'employ travaille dans une entreprise chiffre d'affaire sup a 300000000"); int o ; for (o=0;o<3;o++) entreprise[o].entreprisenom(); System.out.println(" "); System.out.println("question 6 ( suite ) : nom desemploys travaillant dans ces entreprises dont le chiffre d'affaire est sup a 30M "); int p ; for (p=0;p<10;p++) employ[p].nomemploy(); System.out.println(" "); } }

Master1 : Suret de fonctionnement 2011/2012

Fait par : TABET ANIS

Encadreur : Mr REFFAD

/////////////////////////A F F I C H A G E DES R E S U L T A T S///////////////////////////////////


question 3 : employs celibataires nom : ANIS_______ prenom : TABET Situation : Clibataire : pas d'enfants sois 0 enfant nom : B_______ prenom : B Situation : Clibataire ______ d'enfants sois 0 enfant nom : E_______ prenom : E Situation : Clibataire ______ d'enfants sois 0 enfant nom : H_______ prenom : H Situation : Clibataire ______ d'enfants sois 0 enfant nom : I_______ prenom : I Situation : Clibataire ______ d'enfants sois 0 enfant question 3 ( suite ): nom : A_______ prenom nom : C_______ prenom nom : D_______ prenom nom : F_______ prenom nom : G_______ prenom question 4 : employs nom : F_______ prenom nom : G_______ prenom nom : H_______ prenom nom : I_______ prenom employs maris : A Situation : Mari : C Situation : Mari : D Situation : Mari : F Situation : Mari : G Situation : Mari plus age que 30 ans : F age : superieur : G age : superieur : H age : superieur : I age : superieur true______ true______ true______ true______ true______ a a a a 30ans 30ans 30ans 30ans ______ nbr enfants nbr enfants nbr enfants nbr enfants nbr enfants : pas : pas : pas : pas

nbr_enfants nbr_enfants nbr_enfants nbr_enfants nbr_enfants 31 32 32 42 ans ans ans ans

: : : : :

2 4 2 4 2

sois sois sois sois

question 4 ( suite ) : employs moin ags de 30 ans nom : ANIS_______ prenom : TABET age : inferieur a 30ans sois 22 ans nom : A_______ prenom : A age : inferieur a 30ans sois 21 ans nom : B_______ prenom : B age : inferieur a 30ans sois 20 ans nom : C_______ prenom : C age : inferieur a 30ans sois 19 ans nom : D_______ prenom : D age : inferieur a 30ans sois 18 ans nom : E_______ prenom : E age : inferieur a 30ans sois 26 ans question 5 : employs leurs salaire superieur a 28000 DA question 5 ( suite ) : employs leurs salaire inferieur a 28000 DA nom : ANIS_______ prenom : TABET salaire : inferieur a 28000 DA sois 7032.0 DA nom : A_______ prenom : A salaire : inferieur a 28000 DA sois 10526.0 DA nom : B_______ prenom : B salaire : inferieur a 28000 DA sois 2528.0 DA nom : C_______ prenom : C salaire : inferieur a 28000 DA sois 14530.0 DA nom : D_______ prenom : D salaire : inferieur a 28000 DA sois 12530.0 DA nom : E_______ prenom : E salaire : inferieur a 28000 DA sois 9520.0 DA nom : F_______ prenom : F salaire : inferieur a 28000 DA sois 14520.0 DA nom : G_______ prenom : G salaire : inferieur a 28000 DA sois 12520.0 DA nom : H_______ prenom : H salaire : inferieur a 28000 DA sois 9520.0 DA nom : I_______ prenom : I salaire : inferieur a 28000 DA sois 12014.0 DA question 6 : condition pour que l'employ travaille dans une entreprise chiffre d'affaire sup a 300000000 nom de l'entreprise : NKL_______chiffre d'affaire de cette entreprise est: 4.8E8 question 6 ( suite ) : nom desemploys travaillant dans ces entreprises dont le chiffre d'affaire est sup a 30M nom : ANIS_______ prenom : TABET l'employ travaille dans une entreprise ayant un chiffre d'affaire supperieur a 30M sois il travaille a NKL nom : A_______ prenom : A l'employ travaille dans une entreprise ayant un chiffre d'affaire supperieur a 30M sois il travaille a NKL nom : I_______ prenom : I l'employ travaille dans une entreprise ayant un chiffre d'affaire supperieur a 30M sois il travaille a NKL %%%%%%%% FIN DU PROGRAMME %%%%%%%%%%%%%%

Master1 : Suret de fonctionnement 2011/2012

Fait par : TABET ANIS

Encadreur : Mr REFFAD

/////////////////////////////////////////////////////////////////////////// /////////// Autre mthode CLASSE : PRINCIPALE.java //////////

////////////////////////////////////////////////////////////////////////// public class PRINCIPALE { public static void main(String[] args) { entreprise[] entreprise = new entreprise[3]; entreprise [0] =new entreprise("PLA",200000000); entreprise [1] =new entreprise("CDA",15000000); entreprise [2] =new entreprise("NKL",480000000); employ[] employ = new employ[10]; employ[0]=new employ(1,1990,"ANIS","TABET","Stif","Etudiant",16,2000,"NKL"); employ[1]=new employ(1,1991,"A","A","Stif",2,true,"ingenieur",13,1999,"NKL"); employ[2]=new employ(1,1992,"B","B","Stif","ingenieur",14,2009,"CDA"); employ[3]=new employ(1,1993,"C","C","Stif",4,true,"ingenieur",15,1995,"CDA"); employ[4]=new employ(1,1994,"D","D","Stif",2,true,"ingenieur",15,1995,"CDA"); employ[5]=new employ(1,1986,"E","E","Stif","ingenieur",10,1995,"CDA"); employ[6]=new employ(1,1981,"F","F","Stif",4,true,"ingenieur",10,1995,"CDA"); employ[7]=new employ(1,1980,"G","G","Stif",2,true,"ingenieur",10,1995,"PLA"); employ[8]=new employ(1,1980,"H","H","Stif","ingenieur",10,1995,"PLA"); employ[9]=new employ(1,1970,"I","I","Stif","ingenieur",7,1990,"NKL"); int i ; { for (i=0;i<10;i++)

employ[i].afficherpersonnescelib(); System.out.println(" "); employ[i].afficherpersonnesmari(); System.out.println(" "); employ[i].afficherpersonnesplusag(); System.out.println(" "); employ[i].afficherpersonnesmoinag(); System.out.println(" "); employ[i].salaireplus(); System.out.println(" "); employ[i].salairemoin(); System.out.println(" "); employ[i].nomemploy(); System.out.println(" "); } int j ; for (j=0;j<3;j++) entreprise[j].entreprisenom(); System.out.println(" "); System.out.println("%%%%%%%% %%%%%%%%%%%%%%"); } } FIN DU PROGRAMME

Master1 : Suret de fonctionnement 2011/2012

Fait par : TABET ANIS

Encadreur : Mr REFFAD

Vous aimerez peut-être aussi