rss
Twitter Delicious Facebook Digg Stumbleupon Favorites
Showing posts with label prism. Show all posts
Showing posts with label prism. Show all posts

Friday, October 7, 2011

Find the area and volume of a prism

In geometry, a prism is a polyhedron with an n-sided polygonal base, a translated copy (not in the same plane as the first), and n other faces (necessarily all parallelograms) joining corresponding sides of the two bases. All cross-sections parallel to the base faces are the same. Prisms are named for their base, so a prism with a pentagonal base is called a pentagonal prism. The prisms are a subclass of the prismatoids.


class Prism{
 String name;
     double a=2;
     double r=4;
     double h=5;
     double l=6;
 void calculate(){
  System.out.println(3*a*l+a*h);
 }
 void calculate1(){
  System.out.println((a*h*l)/2);
 }
}
class CalPr{
 public static void main(String args[]){
  Prism pr1=new Prism();
  pr1.name="Prism-Area";
  System.out.println(pr1.name);
  pr1.calculate();

 Prism pr2=new Prism();
  pr2.name="Prism-Volume";
  System.out.println(pr2.name);
  pr2.calculate1();
    }
}
Powered by Blogger.