Question: Write a program to display the area of a rectangle after accepting its length and width from the user by means of the following functions:

Write a program to display the area of a rectangle after accepting its length and width from the user by means of the following functions: getLength ask user to enter the length and return it as double getWidth ask user to enter the width and return it as double getArea pass width and length, compute area and return area displayArea pass area and display it in this function.

Expected Output:

(i)

Enter the length: 29

Enter the width: 34

Rectangle Data

--------------

Length: 29

Width: 34

Area: 986

(ii)

Enter the length: 5.98

Enter the width: 29.345

Rectangle Data

--------------

Length: 5.98

Width: 29.345

Area: 175.483

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!