1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| import saisie.Clavier;
public class plusoumoins
{
class Jeu
{
int reponse = 0;
int chiffre = 0;
public Jeu()
{
this.reponse = 156;
}
public Jeu(int a)
{
this.reponse = a;
}
public int demande()
{
this.chiffre = Clavier.lireInt("Quel est le chiffre");
return chiffre;
}
public int plus()
{
System.out.println("Désolé le chiffre est plus grand , veuillez réessayez .");
chiffre = this.demande();
return chiffre;
}
public int moins()
{
System.out.println("Désolé le chiffre est plus petit , veuillez réessayez .");
chiffre = this.demande();
return chiffre;
}
public void bravo()
{
System.out.println("Bravo vous avez trouvé le bon chiffre "+chiffre);
}
}
public static void main(String[] args)
{
Jeu a = new Jeu(12);
}
} |