Challenge 1: Calculating Perimeter and Area of a Rectangle

In this lesson, you will solve a challenge to test your understanding of classes.

Problem Statement

Write a Rectangle class having two float type variables for length and height, a parametrized constructor and two member functions called perimeter and area which return perimeter and area of the rectangle respectively.

Input

Length and width of the rectangle

Output

Perimeter of rectangle and Area of rectangle

Sample Input

length = 2, height = 10

Sample Output

Perimeter = 24
Area = 20

Get hands-on with 1400+ tech skills courses.