Check the attached image for code screenshot and output.
Explanation:
#######################################
Rectangle.cpp
#######################################
#include "Rectangle.h"
Rectangle::Rectangle() {
length = 0;
width = 0;
}
Rectangle::Rectangle(double newLength, double newWidth) {
length = newLength;
width = newWidth;
}
void Rectangle::setLength(double l) {
length = l;
}
void Rectangle::setWidth(double w) {
width = w;
}
double Rectangle::getLength() {
return length;
}
double Rectangle::getWidth() {
return width;
}
double Rectangle::computeArea() {
return length * width;
}
double Rectangle::computePerimeter() {
return 2 * (length + width);
}
Rectangle Rectangle::operator++ () {
length++;
width++;
return *this;
}
Rectangle Rectangle::operator++ (int) {
Rectangle r(length, width);
++length;
++width;
return r;
}
Rectangle Rectangle::operator-- () {
if(length > 0) {
length--;
}
if(width > 0) {
width--;
}
return *this;
}
Rectangle Rectangle::operator-- (int) {
Rectangle r(length, width);
if(length > 0) {
length--;
}
if(width > 0) {
width--;
}
return r;
}
Rectangle Rectangle::operator- (Rectangle other) {
if(length > other.length && width > other.width) {
length--;
width--;
} else {
cout << "invalid operation. Subtrated Rectangle is bigger" << endl;
}
return *this;
}
bool Rectangle::operator==(Rectangle other) {
return (length == other.length) && (width == other.width);
}
bool Rectangle::operator!=(Rectangle other) {
return (length != other.length) || (width != other.width);
}
void Rectangle::printDetails() {
cout << "Rectangle Report" << endl;
cout << "Dimensions: " << length << " X " << width << endl;
cout << "Area: " << computeArea() << endl;
cout << "Perimeter: " << computePerimeter() << endl;
cout << "********************" << endl;
}
#######################################
Rectangle.h
#######################################
#include<iostream>
#include<iomanip>
using namespace std;
class Rectangle {
double length, width;
public:
Rectangle();
Rectangle(double newLength, double newWidth);
void setLength(double l);
void setWidth(double w);
double getLength();
double getWidth();
double computeArea();
double computePerimeter();
Rectangle operator++ ();
Rectangle operator++ (int);
Rectangle operator-- ();
Rectangle operator-- (int);
Rectangle operator- (Rectangle r);
bool operator== (Rectangle r);
bool operator!= (Rectangle r);
void printDetails();
};
#######################################
main.cpp
#######################################
#include "Rectangle.h"
// Ask the user to type in a length and width and
// create an object called rect2 of the rectangle class
// See output for format
cout << "Enter the length of rectangle 3: ";
cin >> l;
cout << "Enter the width of rectangle 3: ";
cin >> w;
Rectangle rect3(l, w);
cout << endl;
cout.setf(ios::fixed);
cout.precision(1);
// Using the member function in the class, print rect1, rect2,
// and rect3 details in that order
rect1.printDetails();
rect2.printDetails();
rect3.printDetails();
cout << endl;
// Print each rectangle in the format shown on the output
cout << "Rectangle 1: " << rect1.getLength() << " X " << rect1.getWidth() << endl;
cout << "Area: " << rect1.computeArea() << " Perimeter: " << rect1.computePerimeter() << endl;
cout << "Rectangle 2: " << rect2.getLength() << " X " << rect2.getWidth() << endl;
cout << "Area: " << rect2.computeArea() << " Perimeter: " << rect2.computePerimeter() << endl;
cout << "Rectangle 3: " << rect3.getLength() << " X " << rect3.getWidth() << endl;
cout << "Area: " << rect3.computeArea() << " Perimeter: " << rect3.computePerimeter() << endl;
if(rect2 == rect3) {
cout << "rectangle 2 and 3 are same." << endl;
} else {
cout << "rectangle 2 and 3 are not same." << endl;
}
cout << "After incrementing rectangle 2: ";
rect2++;
rect2.printDetails();
return 0;
}
Check the attached image for code screenshot and output.
Explanation:
#######################################
Rectangle.cpp
#######################################
#include "Rectangle.h"
Rectangle::Rectangle() {
length = 0;
width = 0;
}
Rectangle::Rectangle(double newLength, double newWidth) {
length = newLength;
width = newWidth;
}
void Rectangle::setLength(double l) {
length = l;
}
void Rectangle::setWidth(double w) {
width = w;
}
double Rectangle::getLength() {
return length;
}
double Rectangle::getWidth() {
return width;
}
double Rectangle::computeArea() {
return length * width;
}
double Rectangle::computePerimeter() {
return 2 * (length + width);
}
Rectangle Rectangle::operator++ () {
length++;
width++;
return *this;
}
Rectangle Rectangle::operator++ (int) {
Rectangle r(length, width);
++length;
++width;
return r;
}
Rectangle Rectangle::operator-- () {
if(length > 0) {
length--;
}
if(width > 0) {
width--;
}
return *this;
}
Rectangle Rectangle::operator-- (int) {
Rectangle r(length, width);
if(length > 0) {
length--;
}
if(width > 0) {
width--;
}
return r;
}
Rectangle Rectangle::operator- (Rectangle other) {
if(length > other.length && width > other.width) {
length--;
width--;
} else {
cout << "invalid operation. Subtrated Rectangle is bigger" << endl;
}
return *this;
}
bool Rectangle::operator==(Rectangle other) {
return (length == other.length) && (width == other.width);
}
bool Rectangle::operator!=(Rectangle other) {
return (length != other.length) || (width != other.width);
}
void Rectangle::printDetails() {
cout << "Rectangle Report" << endl;
cout << "Dimensions: " << length << " X " << width << endl;
cout << "Area: " << computeArea() << endl;
cout << "Perimeter: " << computePerimeter() << endl;
cout << "********************" << endl;
}
#######################################
Rectangle.h
#######################################
#include<iostream>
#include<iomanip>
using namespace std;
class Rectangle {
double length, width;
public:
Rectangle();
Rectangle(double newLength, double newWidth);
void setLength(double l);
void setWidth(double w);
double getLength();
double getWidth();
double computeArea();
double computePerimeter();
Rectangle operator++ ();
Rectangle operator++ (int);
Rectangle operator-- ();
Rectangle operator-- (int);
Rectangle operator- (Rectangle r);
bool operator== (Rectangle r);
bool operator!= (Rectangle r);
void printDetails();
};
#######################################
main.cpp
#######################################
#include "Rectangle.h"
// Ask the user to type in a length and width and
// create an object called rect2 of the rectangle class
// See output for format
cout << "Enter the length of rectangle 3: ";
cin >> l;
cout << "Enter the width of rectangle 3: ";
cin >> w;
Rectangle rect3(l, w);
cout << endl;
cout.setf(ios::fixed);
cout.precision(1);
// Using the member function in the class, print rect1, rect2,
// and rect3 details in that order
rect1.printDetails();
rect2.printDetails();
rect3.printDetails();
cout << endl;
// Print each rectangle in the format shown on the output
cout << "Rectangle 1: " << rect1.getLength() << " X " << rect1.getWidth() << endl;
cout << "Area: " << rect1.computeArea() << " Perimeter: " << rect1.computePerimeter() << endl;
cout << "Rectangle 2: " << rect2.getLength() << " X " << rect2.getWidth() << endl;
cout << "Area: " << rect2.computeArea() << " Perimeter: " << rect2.computePerimeter() << endl;
cout << "Rectangle 3: " << rect3.getLength() << " X " << rect3.getWidth() << endl;
cout << "Area: " << rect3.computeArea() << " Perimeter: " << rect3.computePerimeter() << endl;
if(rect2 == rect3) {
cout << "rectangle 2 and 3 are same." << endl;
} else {
cout << "rectangle 2 and 3 are not same." << endl;
}
cout << "After incrementing rectangle 2: ";
rect2++;
rect2.printDetails();
return 0;
}
5.12 in. by 7.68 in.
Step-by-step explanation:
In similar triangles, the ratios of the lengths of corresponding sides are equal.
width of medium triangle = 4/5 width of large triangle
width of medium triangle = 4/5(8 in.) = 6.4 in.
length of medium triangle = 4/5 length of large triangle
length of medium triangle = 4/5(12 in.) = 9.6 in.
width of small triangle = 4/5 width of medium triangle
width of small triangle = 4/5(6.4 in.) = 5.12 in.
length of small triangle = 4/5 length of medium triangle
length of small triangle = 4/5(9.6 in.) = 7.68 in.
Step-by-step explanation:
a-c. The area formulas for these figures are ...
rectangular prism: A = 2(lw +h(l+w))
cylinder: A = 2πr(r +h)
sphere: A = 4πr^2
d. The total will be the sum of products: area of each pillow times the number of that type
__
e-g. The volume formulas for these figures are ...
rectangular prism: V = lwh
cylinder: V = πr^2h
sphere: V = (4π/3)r^3
h. As with area, the total volume is the sum of products: volume of each pillow times the number of that type.
Step-by-step explanation:
a-c. The area formulas for these figures are ...
rectangular prism: A = 2(lw +h(l+w))
cylinder: A = 2πr(r +h)
sphere: A = 4πr^2
d. The total will be the sum of products: area of each pillow times the number of that type
__
e-g. The volume formulas for these figures are ...
rectangular prism: V = lwh
cylinder: V = πr^2h
sphere: V = (4π/3)r^3
h. As with area, the total volume is the sum of products: volume of each pillow times the number of that type.
Actually, I believe that the scale factor is 1.5, seeing that 42 divided by 28 is 1.5, which is applicable to side AD to get side RS.
I'm still working on reproducing the rectangle, so I'll edit this later to show you the correct answer.
Also, I believe the rectangles look like this:
Actually, I believe that the scale factor is 1.5, seeing that 42 divided by 28 is 1.5, which is applicable to side AD to get side RS.
I'm still working on reproducing the rectangle, so I'll edit this later to show you the correct answer.
Also, I believe the rectangles look like this:
5.12 in. by 7.68 in.
Step-by-step explanation:
In similar triangles, the ratios of the lengths of corresponding sides are equal.
width of medium triangle = 4/5 width of large triangle
width of medium triangle = 4/5(8 in.) = 6.4 in.
length of medium triangle = 4/5 length of large triangle
length of medium triangle = 4/5(12 in.) = 9.6 in.
width of small triangle = 4/5 width of medium triangle
width of small triangle = 4/5(6.4 in.) = 5.12 in.
length of small triangle = 4/5 length of medium triangle
length of small triangle = 4/5(9.6 in.) = 7.68 in.
it is the first one
Step-by-step explanation:
A net is shown with 3 rectangles attached side by side all with width 2 centimeters. The length of the first and third rectangle is 9 centimeters and the middle is 7 centimeters. Attached to the middle rectangle below are 3 rectangles with a length of 7 centimeters. The width of these rectangles are 9 centimeters, 2 centimeters, and 9 centimeters.
Step-by-step explanation:The area of a rectangular prism is the area of 6 surfaces. That is, 3 pairs of surfaces. Each of the three pairs will have one of the sets of dimensions ...
length × widthlength × heightwidth × heightIn order for a net to be a net useful for calculating the prism surface area, it must have 3 pairs of rectangles with these dimensions. The description above matches that requirement.
___
Please note that no two surfaces with the same pair of dimensions are adjacent.
It will provide an instant answer!