0
getArea and getPerimeter
Does anyone know how to write this program with getArea and getPerimeter? https://code.sololearn.com/cM14X8RJY9Cz/?ref=app
2 Réponses
+ 4
static void area(double radius){
double area = (radius*radius)*3.14;
System .out.println("Area of circle:"+area);
return ;
}
Instead of void you need to use double and you need to return the value of your area:
static double getArea(double radius){
//calc area
return area;
}
In your main you need call this method.
Hope this helps
+ 1
Denise Roßberg thanks 🌸