continue
Wed Nov 27 2024 01:02:17 GMT+0000 (Coordinated Universal Time)
Saved by @saharmess #mysql
class employe{ private String nom; private String prenom; private int age; private float salaire; public employe(){ this.nom="sahar"; this.prenom="mess"; this.age=20; this.salaire=4000;} employe(String nom,String prenom,int age,float salaire){ this.nom=nom; this.prenom=prenom; this.age=age; this.salaire=salaire; } employe(employe e){ this.nom=e.nom; this.prenom=e.prenom; this.age=e.age; this.salaire=e.salaire; } public String getNom(){ return this.nom; } public String getPrenom(){ return this.prenom; } int getAge(){ return this.age; } float getSalaire(){ return this.salaire; } void setNom(String nom){ this.nom=nom; } void setPrenom(String prenom){ this.prenom=prenom; } void setAge(int age){ this.age=age; } void setSalaire(float salaire){ this.salaire=salaire; } void aug(float so){ this.salaire+=so; } public String toString(){ String ch; ch="le nom est :"+this.nom+"| prenom est :"+this.prenom+"| age est :"+this.age+"| le salaire est :"+this.salaire; return ch; } public void affiche(){ System.out.println(this.toString()); }} class tech extends employe{ private int grade; public tech(){ this.grade=1; } public tech(String nom,String prenom,int age,float salaire,int grade){ super(nom,prenom,age,salaire); setGrade(grade); } public int getGrade(){ return this.grade; } public void setGrade(int grade){ if(grade>=1 && grade<=3){ this.grade=grade; }else{ System.out.println("grade invalid il doit contrnir 1,2 ou 3"); } } public float prime(){ switch(grade){ case 1:return 100; case 2:return 200; case 3:return 300; default:return 0; } } public String toString(){ String ch; ch=super.toString()+", grade:"+this.grade+", prime"+this.prime(); return ch; } void augmentation(){ super.aug(this.prime()); } } class equipe{ tech[] tab=new tech[10]; equipe(tech[] t){ tab=t; } } public class Main{ public static void main(String [] args){ employe E1=new employe(); employe E2=new employe("sarsar","messour",19,4000); tech t1=new tech(); tech t2=new tech("ahmed","messaoui",49,3500,1); E1.affiche(); E2.affiche(); t1.affiche(); t2.affiche(); E1.aug(200); E1.affiche(); t1.setGrade(2); t1.augmentation(); t1.affiche(); tech t22 = new tech("Lemoine", "Claire", 28, 1900, 2); tech t3 = new tech("Bernard", "Alice", 32, 2100, 1); tech t4 = new tech("Durand", "Eric", 27, 1950, 1); tech t5 = new tech("Morel", "Sophie", 26, 1850, 2); tech[] tab={t1,t2,t3,t4,t5}; equipe eq=new equipe(tab); Technicien meilleur = techniciens[0]; for (tech tab : 10) { if (t.getSalaire() > meilleur.getSalaire()) { meilleur = t; } } tech mei=grmax; System.out.println("le plus rande est:"); System.out.println(mei); } }
Comments