class Rectangle

Rectangle class derived from Shape.

Represents a rectangle with a given width and height.

Public Methods

            
void Rectangle (double width, double height)
            
        

Constructs a new Rectangle object.

Parameters

width

Width of the rectangle.

height

Height of the rectangle.

            
double area ()
            
        

Calculates the area of the rectangle.

Returns

double The area of the rectangle.

            
double perimeter ()
            
        

Calculates the perimeter of the rectangle.

Returns

double The perimeter of the rectangle.