Question: Using C++ to solve these problems The code below is supposed to print Side1=3, Side2=4, We have doubled each side, so now:, Side1=6, and Side2=8,

Using C++ to solve these problems

The code below is supposed to print Side1=3, Side2=4, We have doubled each side, so now:, Side1=6, and Side2=8, each on its own line. For this problem, you need to do the following.

  1. fix it so that it works properly. The solution required writing a few short member functions for the Rectangle class and making a few minor modifications to the main body. (You are not allowed to make side1 and side2 public.)

  2. Delete my comments and add your own. When you are done, there should be comments immediately be before all of the functions except for constructors and the main function. You should also comment on any other lines you change or add. For this problem, you dont need to add any other comments, but if you chose to do so it might help us give you par- tial credit. For this problem, you can write all member functions inside the class definition. (You dont have to use function declarations.)Using C++ to solve these problems The code below is supposed to

1 #include 2 using namespace std; 3 4 class Rectangle{ 5 public: 6 Rectangle():side1(0),side2(0){} 7 Rectangle(double x) :side1(x), side2(x) {} 8 Rectangle (double x, double y) :side1(x), side2(y) {} 9 10 private: //You are NOT allowed to remove the word private 11 // or make the member variables public in any way 12 double side1; 13 double side2; 14 }; 15 16 int main() { 17 18 Rectangle r(3, 4); 19 cout

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!