public class AreaVol{
public static void main(String [] args){
double lr=3, wr=2, hr=0.5, ar=0, vr=0;
ar=lr*wr;
System.out.println("Area of rectangle="+ar);
vr=lr*wr*hr;
System.out.println("Volume of rectangle="+vr);
double bt=2, ht=3.2, at=0;
at=bt*(ht/2);
System.out.println("\nArea of triangle="+at);
double pi=3.1416, rc=3.7, ac=0;
ac=pi*rc*rc;
System.out.println("\nArea of circle="+ac);
double rade1=3, rade2=3.75, ae=0;
ae=pi*rade1*rade2;
System.out.println("\nArea of Ellipse="+ae);
double sideSq=3.6, aSq=0;
aSq=sideSq*sideSq;
System.out.println("\nArea of Square="+aSq);
double hTr=2.6,base1Tr=3.4,base2Tr=4.8,aTr=0;
aTr=hTr*((base1Tr+base2Tr)/2);
System.out.println("\nArea of trapezoid="+aTr);
double diag1r=3, diag2r=9, adiag=0;
adiag=(diag1r*diag2r)/2;
System.out.println("\nArea of Rhombus="+adiag);
double rSphr=5.3, aSphr=0, vSphr=0;
aSphr=4*pi*rSphr*rSphr;
System.out.println("\nArea of Sphere="+aSphr);
vSphr=(4*pi*rSphr*rSphr*rSphr)/3;
System.out.println("Volume of Sphere="+vSphr);
double rCyl=2.3, hCyl=5.6, aCyl=0, vCyl=0;
aCyl=2*pi*rCyl*hCyl+2*pi*rCyl*rCyl;
System.out.println("\nArea of Sphere="+aCyl);
vCyl=pi*rCyl*rCyl*hCyl;
System.out.println("Volume of Cylinder="+vCyl);
}
}
public static void main(String [] args){
double lr=3, wr=2, hr=0.5, ar=0, vr=0;
ar=lr*wr;
System.out.println("Area of rectangle="+ar);
vr=lr*wr*hr;
System.out.println("Volume of rectangle="+vr);
double bt=2, ht=3.2, at=0;
at=bt*(ht/2);
System.out.println("\nArea of triangle="+at);
double pi=3.1416, rc=3.7, ac=0;
ac=pi*rc*rc;
System.out.println("\nArea of circle="+ac);
double rade1=3, rade2=3.75, ae=0;
ae=pi*rade1*rade2;
System.out.println("\nArea of Ellipse="+ae);
double sideSq=3.6, aSq=0;
aSq=sideSq*sideSq;
System.out.println("\nArea of Square="+aSq);
double hTr=2.6,base1Tr=3.4,base2Tr=4.8,aTr=0;
aTr=hTr*((base1Tr+base2Tr)/2);
System.out.println("\nArea of trapezoid="+aTr);
double diag1r=3, diag2r=9, adiag=0;
adiag=(diag1r*diag2r)/2;
System.out.println("\nArea of Rhombus="+adiag);
double rSphr=5.3, aSphr=0, vSphr=0;
aSphr=4*pi*rSphr*rSphr;
System.out.println("\nArea of Sphere="+aSphr);
vSphr=(4*pi*rSphr*rSphr*rSphr)/3;
System.out.println("Volume of Sphere="+vSphr);
double rCyl=2.3, hCyl=5.6, aCyl=0, vCyl=0;
aCyl=2*pi*rCyl*hCyl+2*pi*rCyl*rCyl;
System.out.println("\nArea of Sphere="+aCyl);
vCyl=pi*rCyl*rCyl*hCyl;
System.out.println("Volume of Cylinder="+vCyl);
}
}
No comments:
Post a Comment