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;
3939
4040class Darts {
4141
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 ;
4545
4646 int score (double x , double y ) {
4747 var pointRadius = (Math . sqrt((x * x) + (y * y)));
4848 DoublePredicate thrownOutside = ring - > pointRadius > ring;
4949
50- if (thrownOutside. test(outerRing ))
50+ if (thrownOutside. test(OUTER_RING ))
5151 return 0 ;
52- if (thrownOutside. test(middleRing ))
52+ if (thrownOutside. test(MIDDLE_RING ))
5353 return 1 ;
54- if (thrownOutside. test(innerRing ))
54+ if (thrownOutside. test(INNER_RING ))
5555 return 5 ;
5656 return 10 ;
5757 }
You can’t perform that action at this time.
0 commit comments