Question
This is all one question and not very difficult, please have comments that explain the codes as I am facing issues with them. I will
This is all one question and not very difficult, please have comments that explain the codes as I am facing issues with them. I will definitely appreciate and thumbs up to your hard work if the codes work, you can be creative if you want with it as well. Thanks!
Please use C++ (I code in VS 2022) and use your object-oriented programming skills to write a well-structured, readable, and clean code that deals with shapes and operators (+ and *) based on the given requirements below. Mainly you have two shapes: Rectangle and Square. You should design both shapes so that you can do the following math: Rectangle r = r1 * 2 + r2; Where r1 and r2 of type Rectangle. The above equation is explained below.
1- Design, implement and test a Rectangle class which: a. Has a function to calculate its area. b. It can be printed using cout
2- Design, implement and test a Square class which: a. Has a function to calculate its area. b. It can be printed using cout
3- As stated at the beginning, you should design your Rectangle classes so that you can apply the following math: Rectangle r = r1 * 2 + r2; Where r1 and r2 of type Rectangle. r1 + r2 : results in a Rectangle with a length equal to the summation of both lengths and width equal to the summation of both widths. r*2 : results in a Rectangle with the length and the width scaled by 2. If the r Rectangle length = 4 and width = 2 then r*2 will result in a Rectangle with length = 8 and width = 4.
4- You should design your Square classes so that you can apply the following math: Square S = S1 * 2 + S2; Where S1 and S2 of type Square. S1 + S2 -> results in a square with a side length equal to the summation of both sides (s1 side and s2 sides). S*2 -> results in a square with side length scaled by 2. If the S square side length = 4 then S*2 will result in a square with a side length = 8.
2+=Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started