"More on classes" (Shapes) bug?" (Java) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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?

3rd May 2021, 10:06 PM
Nieves Cubo
Nieves Cubo - avatar
2 Answers
+ 1
I passed all test cases. May you provide your code?
3rd May 2021, 10:50 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 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.
3rd May 2021, 11:54 PM
Odyel
Odyel - avatar