Division.java
664 Bytes
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
43
44
45
46
47
package noyau;
import noyau.exception.CellNotFoundException;
import noyau.exception.DivisionByZeroException;
public class Division extends OperationBinaire{
Division(Case g,Case d){
gauche=g;
droite=d;
}
public double eval() throws DivisionByZeroException {
try{
if (!creerCycle(gauche) && !creerCycle(droite))
return gauche.getValue()/droite.getValue();
else
return 0;
}
catch(ArithmeticException ex){
throw new DivisionByZeroException();
}
}
public String toString(){
return gauche.getId() +" / " + droite.getId() ;
}
public String getFormuleDeveloppe(){
return "";
}
}