The document contains code for two Java classes - Score and CompteBanquaire. The Score class defines fields and methods for a scoring object including score, name and methods to display, read, modify and add to the score. The CompteBanquaire class defines fields and methods for a bank account including account number, name, credit and get/set methods as well as a method to debit the account.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
13 views3 pages
TD Poo
The document contains code for two Java classes - Score and CompteBanquaire. The Score class defines fields and methods for a scoring object including score, name and methods to display, read, modify and add to the score. The CompteBanquaire class defines fields and methods for a bank account including account number, name, credit and get/set methods as well as a method to debit the account.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
Exercice 2:
public int Score{
//Champ public int scoreMax; public int sonScore; public string nom; //Méthode public Score(String nom){ this.som=0; this.sonScore=0; this.nom=‘’nom’’; this.scoreMax=100; }
public void afficher(){
System.out.println(‘’nom :’’ +’’this.nom+’’\n Score :’’ +this.sonScore); } public int lireScore(){ return this.sonScore; } public void modifierScore(int sco){ if (sco>=0 &&sco<=this.scoreMax) this.score=sco; } public void ajouter (int points){ if (points>0 && points+this.score<=100) this.score+=points; } }
Exercice 4:
public class compteBanquaire{
private int numCompte; private string Titulaire; private int Credit //Methode get public int getNomCompte(){ return this NomCompte; } public int Credit(){ return this.Credit; } public string get Titulaire(){ return this.Titulaire; } //Methode Set public void set NomCompte(int compte){ this.NumCompte=NumCompte; } public void set Credit(int Credit){ this.Credit=Credit; } public void set Titulaire(string Titulaire){ this.Titulaire=Titulaire; } //Methode pour débiter public void debiter (Double nomDebit){ if(MontantDebit<=thisCredit && MontantDebit>0);{ thisCredit += MontantDebit; system.out.println(‘’Le montant est’’+MontantDebit); } else{ system.out.println(‘’Le montant est Insuffisant ’’); } } public CompteBanquaire(int NumCompte, string titulaire, int credit){ this.NumCompte = NumCompte; this.Titulaire = Titulaire; this.Credit = Credit; } public class Banquetassions{ public static void main } }