Computer Science, asked by prashant21547, 8 months ago

Answer the given question correctly otherwise I will report your answer..
No spam needed.. ​

Attachments:

Answers

Answered by kingcobra1
1

Answer:

importJava.util.*

public class Area

{

public static void main(int a)

{

Scanner sc=new Scanner(System.in)

System.out.println("write 1 for circle 2 for square and 3 for rectangle");

if(a==1)

{

double w=sc.nextInt();

double area=double Circle(w);

System.out.println(area);

}

else if(a==2)

{

int e=sc.nextInt();

double area=int Square(e);

System.out.println(area);

}

else if(a==3)

{

int j=sc.nextInt();

int h=sc.nextInt();

double area=int rectangle(j,h);

System.out.println(area);

}

}

public static int Square(int s)

{

double x=Math.pow(s,2);

return x;

}

public static double Circle(double r)

{

double y=(22/7)*Math.pow(r,2);

return y;

}

public static int rectangle(int l;int b)

{

double q=l*b;

return q;

}

}

}

Explanation:

i hope it works!

"*" means multiply

let me know in the comments if any error occurs

Similar questions