Correction-DS 2019
Correction-DS 2019
Correction-DS 2019
Questions (3 Points)
1- La méthode main est static cad qu’elle peut être appelée à travers sa classe.
2- Création d’un objet de la classe Exemple avec la valeur 10 pour l’attribut.
Création d’un tableau de 10 cases qui vont être initialisées à la valeur null.
Problème
Question1 (5 Points)
class Medecin {
{ this.codeCnam=c;
this.NomPrenom=np;
this.Spécialité=sp;
this.tarif=t; }
return this.recette;}
{ this.recette=r;}
{return this.nb_Cons;}
this.nb_Cons++;}
{return
(this.codeCnam==m.codeCnam)&&(this.nomPrenom.equals(m.nomPrenom);}
1
@Override
+"\nTarif="+this.tarif; }}
Question2 (8 Points)
class Consultation {
{ this.CodeCons=c;
this.nomPrePatient=np;
this.dateCons=Date.getDate();
this.régimeCnamPatient=r; }
{ float r;
if((m.getNb_cons()<10)) //
{ LeMedecin=m; //
m.setNb_cons(); //
r=m.getRecette()+this.calculerTarifCons(); //
m.setRecette(r); //}}
{ if((this.LeMedecin.codeCnam==0)||(!this.régimeCnamPatient.equals("Medecin
de famille")))
return LeMedecin.tarif;
else
return (LeMedecin.tarif/2);
2
}
void afficher()
{ System.out.println("\nNom&Prenom
:"+this.nomPrePatient+"\nLe:"+this.dateCons.toString()+"\nDr:"+
Question 3 (4 Points)
import java.util.Scanner;
co=s.nextInt();
NP=s.next();
RC=s.next();
c.AffecterMedecin(M1);
c.afficher();
}}