0% found this document useful (0 votes)
24 views1 page

Filter

The document contains code to calculate the areas of different shapes like trapezoids, ellipses and equilateral triangles by prompting the user for inputs and outputting the calculated area.

Uploaded by

Insha Ringor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Filter

The document contains code to calculate the areas of different shapes like trapezoids, ellipses and equilateral triangles by prompting the user for inputs and outputting the calculated area.

Uploaded by

Insha Ringor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

Scanner;
public class {
public static void main(String[] args){

int trapezoid=(((b1+b2)/2)*h);
System.out.print("Area of Trapeziod is "+ trapezoid);break;
case 2:System.out.println("Ellipse");
System.out.print("Enter r1: ");
double r1= kbd.nextDouble();

System.out.print("Enter r2: ");


double r2= kbd.nextDouble();
double Pi=3.14159;
double e=Pi*(r1*r2);
double ellipse = Math.round(e*100.0)/100.0;
System.out.print("Area of Ellipse is "+ ellipse);break;
case 3:System.out.println("Equilateral Triangle");
System.out.print("Enter a: ");
double a= kbd.nextDouble();
double Equi=((Math.sqrt(3)*(Math.pow(a,2))/4));
double EquiTriangle = Math.round(Equi*10)/10.0;
System.out.println("Area of Equilateral Triangle is "+
EquiTriangle);break;
}
}
}

You might also like