*/I believe I did a good job with constructing my program.
Please review and feel free to offer any guidelines or
tips as I am stuck. I am referring to my text for an
example program but I cannot seem to find one that fits.
Am I at least in the ballpark?*/
//Here's my problem...
*/Part a - Construct a class named Rectangle that has floating-point
data members named length and width. The class should have
a constructor that sets each data member to 0, member functions
named perimeter() and area() to calculate the perimeter and
area of a rectangle, respectively, a member function named
setdata() to set a rectangle's length and width, and a member
function named (showdata) that displays a rectangle's length,
width, perimeter, and area.
Part b. - Then include the Rectangle class
within a working C++ program.*/
//Part a.
#include <iostream.h>
#include <iomanip.h>
class Rectangle //class declaration
Private:
float length;
float width;
Public
Rectangle (float = 0, float = 0);
float perimeter();
float area ();
void setdata (float length, float width);
void showdata();
};
int main()
//Should I create rectangle objects and call methods here?
//Please provide an example
}
Perimter: (2 * length + 2 * width)
Area: (length * width)
setdata: //Not sure what goes here?
showdata: //I figure that here I should display length,
width, perimter, and area, then call perimeter and
area from in main?
//Part b.
//brainstorming
//create two objects and call at least one
//rectangle r1, r2, r3
//float temp = (result should be zero)
//length + width and give some values
I sent this e-mail for a kick start only. I am reading right now because maybe I missed something.