Problème d'indentation et d'accolade,
l’accolade fermente du catch se trouve en fin de ficher.
au lieu d’initialiser choix en tant que double, il faut l'initialiser en char. :
double choix = ' ''
devient
char double = ' '
Puis je vois pas pour quoi tu utilise un BufferedReader alors que tu as déjà un Scanner.
Sinon pour tes boucle j'aurais fais ca comme ca :
Scanner sc = new Scanner(System.in);
double choix = 0;
char reponse = '';
boolean errorInput = false;
do {
do {
System.out.println("Veuillez Indiquez la taille");
try{
errorInput = false;
choix = sc.nextDouble();
}
catch ( InputMismatchException e){
System.out.println("Erreur entree non valide");
errorInput = true;
}
} while ( errorInput );
System.out.println("nn");
do {
System.out.println("Vous avez indiquer vouloir une tv de taille" +choix);
System.out.println("Souhaitez-vous recommencer ? O/N");
try {
errorInput = false;
reponse = sc.nextLine().charAt(0);
}
catch ( InputMismatchException e){
System.out.println("Erreur entree non valide");
errorInput = true;
}
} while ( errorInput );
} while ( reponse == 'O' || reponse == 'o' );
Message édité le 27 septembre 2015 à 02:49:14 par 89ron