In Class - class
Create a class Rectangle. The class has attributes length and
width, each of which defaults to 1. It has member functions to calculate
the perimeter and the area of the rectangle. It has set and get functions for
the attributes.. Set should verify the attribute is a floating point number
larger than 0.0 and less than 20.0.
- What is the class called.?
_____________________________
- What data members are in the class?
____________________________
- What access modifier should the data member have?
____________________________
- What member functions need to be defined?
____________________________
____________________________
____________________________
____________________________
____________________________
____________________________
- What does the prototype look like for the area member function?
_________________________________
- What does a get for length prototype look like?
__________________________________
- What does a set for length prototype look like?
___________________________________
- Write the function for area.
- How would the area function be invoked?
- Do we need multiple (overloaded) functions for the contruction?
It
should be able to handle the following instances.
Rectangle a;
Rectangle b(20.0); // Set the length
Rectanglec(10.0,10.0) //
set the length and widt
- Write the constructor
.
.
.
.
.
.
- What does the header file look like for this project??
- Write the member functions
- Write the main file.
- Compile the project and run it!