1 16 17 package org.apache.cocoon.samples.tour.shapes; 18 19 22 public class Rectangular implements Shape{ 23 double _h; 24 double _b; 25 26 public Rectangular(double h, double b) { 27 _h = h; 28 _b = b; 29 } 30 31 public String getName() { 32 return "Rectangular"; 33 } 34 35 public double getArea(){ 36 return _h * _b; 37 } 38 39 public double getPerimeter(){ 40 return (_h + _b) * 2; 41 } 42 43 } 44 | Popular Tags |