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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started