Code cleanup : fix C style array declaration.
[Project_POO.git] / exo6 / Chiffre.java
CommitLineData
dd8febe8
JB
1
2class Chiffre extends Facteur {
c9ca2283 3 Character c;
dd8febe8 4
c9ca2283
JB
5 Chiffre(Character c) throws NotCharacterException {
6 //TODO?: remove extragenous whitespace
7 if (Character.isLetterOrDigit(c)) {
8 this.c = c;
9 } else {
10 throw new NotCharacterException(c + " is not a character type");
11 }
12 }
13
14 private boolean isChiffre() {
15 return Character.isDigit(c);
16 }
efaffa4d 17
c7043054
JB
18 public double evaluer() throws NotDigitException {
19 if(isChiffre()) {
20 return Character.getNumericValue(c);
21 } else {
22 throw new NotDigitException(c + " is not a digit");
23 }
dd8febe8
JB
24 }
25}