Using the code given in rectangle.cpp, implement the functions that are called in the main function to complete the program. You must not change any of the existing code in the file. You can only add functions and comments to the code.

Here's a sample run of how the program should behave:

Enter rectangle length: -1 <-- invalid value, ask user to re-enter
Enter rectangle length: -2 <-- invalid value
Enter rectangle length: 0 <-- invalid value
Enter rectangle length: 3 <-- valid, accept
Enter rectangle width: -5 <-- invalid value
Enter rectangle width: 0 <-- invalid value
Enter rectangle width: 5 <-- valid, accept
Rectangle Data
--------------
Length: 3
Width: 5
Area: 15
Perimeter: 16

Notes:

1. any length and width values less than or equal to zero are ignored and the user is asked to re-enter the value

Source code to complete:

/*
* This program computes the area and perimeter of a rectangle
* given the length and width.
*
* CS1160 - Assignment 6
* Author: < your name here>
*/
#include < iostream>
using namespace std;

void getLengthAndWidth(double&, double&);
double calcArea(double, double);
double calcPerimeter(double, double);
void displayData(double, double, double, double);

int main()
{
double length, width, area, perimeter;

// get the length and the width from the user
getLengthAndWidth(length, width);

// calculate the area of the rectangle
area = calcArea(length, width);

// calculate the perimeter of the rectangle
perimeter = calcPerimeter(length, width);

// display above data to the user
displayData(length, width, area, perimeter);

return 0;
}
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.