Consider the following class definition class rectangleType { public: //Postcond
ID: 3664022 • Letter: C
Question
Consider the following class definition
class rectangleType
{
public:
//Postcondition: length = x; width = y;
void setLengthWidth(double x, double y);
//Output length and width;
void print() const;
//Calculate and return the area of the rectangle;
double area();
//Calculate and return the parameter;
double perimeter();
//Postcondition: length = 0; width = 0;
rectangleType();
//Postcondition: length = x; width = y;
rectangleType(double x, double y);
private:
double length;
double width;
};
// and the object declaration
rectangleType bigRect(14,10);
Which of the following statements is correct?
bigRect.setLengthWidth();
bigRect.setLengthWidth(3.0, 2.0);
bigRect.length = 2.0;
bigRect.length = bigRect.width;
A(n) _____ relationship represents composition.
"has a"
"is a"
"part of"
logical
Explanation / Answer
which of the following statement is correct
bigRect.setLengthWidth (3.0,2.0)
composition is a(n) has a relationship
example of composition
A class contains students. A student cannot exist without a class. There exists composition between class and students
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.