0
"More on classes" (Shapes) bug?" (Java)
When solving the "Shapes" problems, the final exercise for the "more on classes" section, ones test case is not correct, but the others are. Can it be a bug on the test cases?
2 RĂ©ponses
+ 1
I passed all test cases.
May you provide your code?
+ 1
It might be the way you've calculated the circle's area. If you calculate the area like Math.PI*(radius*radius) there may be misrepresentation; doubles are prone to do that. Instead calculate the area like:
Math.PI*radius*radius
Without the parentheses. Both are mathematically correct but the parentheses one might cause trouble because of the nature of doubles.