Public Class RectBox
}
Private int _height
Private int _width;
Public void SetHeight (int h)
{
_height=h;
}
Public int GetHeight ()
{
Return _height;
}
Public void SeWidth (int w)
{
_width=w;
}
Public int GetWidth ()
{
Return _width;
}
Public int Area ()
{
Return _width*_height;
}
Public int Surface ()
{
Return 2*(_height+_width);
----------------------------------------------
Rectbox (definition)= new rectbox();(creation)
Box.setwidth (10);
Box.setheight(20);
Int a=box.area();
Int s=box.surface();
----------------------------------------------
برچسب:
نویسنده: سارا حکیمی