How can I do the code of the activity called forms in the java course | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I do the code of the activity called forms in the java course

My code resolved 4/5 cases and missing case is locked and Is the case three , so i can't see what Is the problem. Help me please it's the last thing i need

7th Apr 2021, 7:17 AM
Carlos Arturo Diaz Artiaga
Carlos Arturo Diaz Artiaga - avatar
8 Answers
+ 2
Where's the code?
7th Apr 2021, 7:19 AM
Soumik
Soumik - avatar
+ 2
Carlos Arturo Diaz Artiaga Use this.width in the constructors instead of super.width (updated and works) https://code.sololearn.com/cG8DTo1h47k5/?ref=app
7th Apr 2021, 7:27 AM
Soumik
Soumik - avatar
+ 2
While the output of your code is correct, you should use 'this' instead of 'super' as Soumik stated. That being said, there seems to be a bug that if you output the area with parentheses like; System.out.println((width * width)* Math.PI); it shows the one test as incorrect, even though the output is the same with them or without. Just remove the parentheses and it should pass. System.out.println(Math.PI*width*width);
7th Apr 2021, 7:38 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Soumik ChaoticDawg Thank you, I could finally finish the course
7th Apr 2021, 7:49 AM
Carlos Arturo Diaz Artiaga
Carlos Arturo Diaz Artiaga - avatar
+ 1
ChaoticDawg Carlos Arturo Diaz Artiaga Yes i just realized that width * width * Math.PI doesn't work but Math.PI * width * width works. They are strictly following the π * r * r formula. Lol
7th Apr 2021, 7:45 AM
Soumik
Soumik - avatar
7th Apr 2021, 7:21 AM
Carlos Arturo Diaz Artiaga
Carlos Arturo Diaz Artiaga - avatar
0
Soumik that Is my code
7th Apr 2021, 7:22 AM
Carlos Arturo Diaz Artiaga
Carlos Arturo Diaz Artiaga - avatar
0
Soumik is the same problem brother, cases one, two, four and five are fulfilled but case three is not and I do not know why
7th Apr 2021, 7:35 AM
Carlos Arturo Diaz Artiaga
Carlos Arturo Diaz Artiaga - avatar