Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Q4. Class Rectangle

Problem Description

Construct a class Rectangle that represents a rectangle.

The class should support the following functionalities:-

perimeter() -> returns the perimeter of the rectangle
area() -> returns the area of the rectangle

Input format:

First argument A is an integer representing the number of testcases. For each case, x (length) and y (breadth) are taken as input in new line.

Output format:

The perimeter and area of the constructed rectangle are printed.

Sample Input:

1 # number of cases
1 # radius of first case
2 # radius of second case

Sample output:

4 #perimeter of rectangle
1 #area of rectangle