+ 1

I just wanted to ask if my codes are good or there is a shorter or more effective way to make It?

https://code.sololearn.com/c8WM3tsxYTf9/?ref=app https://code.sololearn.com/c23sFfTvrpz7/?ref=app

30th Jan 2020, 8:33 AM
Ayaan Siddiqui
Ayaan Siddiqui - avatar
2 Antworten
+ 2
tips for surface for pi use Math.PI float point numbers input double r = in.nextDouble(); output with round to 2 dec System.out.printf("Radius = %.2f , Height = %.2f\n", r, h); string + string write as one stringstring // System.out.println(" = " + "2 × pi × r × h" + " = " + " 2 " + " × " + "3.14" + " × " + r + " × " + h); System.out.println(" = 2 × pi × r × h = 2 × 3.14 × " +r +" × " +h); add empty lines between results System.out.println(); it is better to keep part for calculations separate from the output next you can add class Cylinder with two static methods curvedArea(double radius, double height) totalArea(double radius, double height) and call it System.out.println(" = " +Cylinder.totalArea(r, h) );
30th Jan 2020, 5:37 PM
zemiak
0
Thanks Man!
31st Jan 2020, 3:21 AM
Ayaan Siddiqui
Ayaan Siddiqui - avatar