File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
exercises/practice/darts/.approaches Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -39,19 +39,19 @@ import java.util.function.DoublePredicate;
39
39
40
40
class Darts {
41
41
42
- final private static double innerRing = 1.0 ;
43
- final private static double middleRing = 5.0 ;
44
- final private static double outerRing = 10.0 ;
42
+ private static final double INNER_RING = 1.0 ;
43
+ private static final double MIDDLE_RING = 5.0 ;
44
+ private static final double OUTER_RING = 10.0 ;
45
45
46
46
int score (double x , double y ) {
47
47
var pointRadius = (Math . sqrt((x * x) + (y * y)));
48
48
DoublePredicate thrownOutside = ring - > pointRadius > ring;
49
49
50
- if (thrownOutside. test(outerRing ))
50
+ if (thrownOutside. test(OUTER_RING ))
51
51
return 0 ;
52
- if (thrownOutside. test(middleRing ))
52
+ if (thrownOutside. test(MIDDLE_RING ))
53
53
return 1 ;
54
- if (thrownOutside. test(innerRing ))
54
+ if (thrownOutside. test(INNER_RING ))
55
55
return 5 ;
56
56
return 10 ;
57
57
}
You can’t perform that action at this time.
0 commit comments