Question: 9 . 2 3 . 5 : Rearrange the code to implement a class that describes a square with the perimeter as a data member.

9.23.5: Rearrange the code to implement a class that describes a square with the perimeter as a data member.
Full screen
541708.3480878.qx3zqy7
Repeat the preceding
Repeat the preceding exercise, but with the perimeter, not the side length, as a data member. Here is the revised class definition.
class Square
{
public:
void set_side(int initial_length);
void grow(int amount);
int get_perimeter() const;
int get_side_length() const;
private:
int perimeter;
};
The interface of the class should be unchanged. Not all lines are useful.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!