Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i have to find the area of a rectangle. any help? Here is what i have so far //I

ID: 3632234 • Letter: I

Question

i have to find the area of a rectangle. any help? Here is what i have so far



//Include the heading comments
// Rectangle Area - Complete the Program
#include <iostream>
using namespace std;

// Function prototypes
void displayData(double, double, double);

//Add the function prototypes need for the functions below.
double getLength(double);
double getArea(double);
double getWidth(double);
int main()
{
double length, // The rectangle's length
width, // The rectangle's width
area; // The rectangle's area

// Get the rectangle's length.
getLength();

// Get the rectangle's width.
getWidth();

// Get the rectangle's area.
getArea();

// Display the rectangle's data.
displayData();
system ("pause");
return 0;
}

//***************************************************
// getLength function *
//***************************************************

double getLength()
{
double length; // To hold a length

// Get the length.
cout << "Please enter rectangle's length: ";
cin >> length;
// Return the length.
return length;
}

//***************************************************
// getWidth function *
//***************************************************

double getWidth()
{
double width; // To hold a width

// Get the width.
cout << "Please enter rectangle's width: ";
cin >> width;

// Return the width.
return width;
}

//***************************************************
// getArea function *
//***************************************************

double getArea(double length, double width)
{
double area; // To hold the area

// Calculate the area.
area = length * width;

// Return the area.
return area;
}

//***************************************************
// displayData function *
//***************************************************

void displayData(double length, double width, double area)
{
cout << "Rectangle Data "
<< "-------------- ";
cout << "Rectangle Area is: " << area << endl;
}

Explanation / Answer

please rate - thanks




//Include the heading comments
// Rectangle Area - Complete the Program
#include <iostream>
using namespace std;

// Function prototypes
void displayData(double, double, double);

//Add the function prototypes need for the functions below.
double getLength();
double getArea(double,double);
double getWidth();
int main()
{
double length, // The rectangle's length
width, // The rectangle's width
area; // The rectangle's area

// Get the rectangle's length.
length=getLength();

// Get the rectangle's width.
width=getWidth();

// Get the rectangle's area.
area=getArea(length,width);

// Display the rectangle's data.
displayData(length,width,area);
system ("pause");
return 0;
}

//***************************************************
// getLength function *
//***************************************************

double getLength()
{
double length; // To hold a length

// Get the length.
cout << "Please enter rectangle's length: ";
cin >> length;
// Return the length.
return length;
}

//***************************************************
// getWidth function *
//***************************************************

double getWidth()
{
double width; // To hold a width

// Get the width.
cout << "Please enter rectangle's width: ";
cin >> width;

// Return the width.
return width;
}

//***************************************************
// getArea function *
//***************************************************

double getArea(double length, double width)
{
double area; // To hold the area

// Calculate the area.
area = length * width;

// Return the area.
return area;
}

//***************************************************
// displayData function *
//***************************************************

void displayData(double length, double width, double area)
{
cout << "Rectangle Data length= "<<length<<" width= "<<width
<< " ------------------ ";
cout << "Rectangle Area is: " << area << endl;
}