Write a Rectangle class that has the following fields: Length (L): a double - Width (W): a double The class should have the following functions: Constructor: accepts the length (L) and the width (W)...


Write a Rectangle class that has the following fields:<br>Length (L): a double<br>- Width (W): a double<br>The class should have the following functions:<br>Constructor: accepts the length (L) and the width (W) of a rectangle as arguments.<br>Constructor: does not take any parameters and initializes the length(L) and width(W)<br>to zero.<br>- A function called getArea which returns the area of the rectangle.<br>A function called getPerimeter which returns the perimeter of the rectangle.<br>{note: The area of a rectangle =L*W, and its perimeter = 2*(L+W) }<br>Then, write a program to ask the user to enter the length and width of a rectangle, and then<br>use the above class to calculate and print the area and perimeter of the rectangle.<br>

Extracted text: Write a Rectangle class that has the following fields: Length (L): a double - Width (W): a double The class should have the following functions: Constructor: accepts the length (L) and the width (W) of a rectangle as arguments. Constructor: does not take any parameters and initializes the length(L) and width(W) to zero. - A function called getArea which returns the area of the rectangle. A function called getPerimeter which returns the perimeter of the rectangle. {note: The area of a rectangle =L*W, and its perimeter = 2*(L+W) } Then, write a program to ask the user to enter the length and width of a rectangle, and then use the above class to calculate and print the area and perimeter of the rectangle.

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here