Académique Documents
Professionnel Documents
Culture Documents
Exercice 2 :
public class Personne {
private String nom, prenom;
private int age;
void afficher() {
System.out.println("Nom: " + nom + ", Prenom: " + prenom + ", Age: " + age + " ans");}
}
void deposer(double s) {
solde += s; }
void retirer(double s) {
if (solde > s)
solde -= s;
else
System.out.println("Solde insuffisant"); }
void info() {
System.out.println("Compte numéro: " + numeroCompte + ", solde: " + solde + "Dhs");}
}
void afficher() {
super.afficher();
compte.info(); }
}
Exercice 3 :
public class FormeFigure {
private double x, y;
private String a;
public FormeFigure(double x, double y, String a){
this.x = x;
this.y = y;
this.a = a; }