Given the Code in (Visual Studio) C++ (2 files their links are posted below) all
ID: 3827751 • Letter: G
Question
Given the Code in (Visual Studio) C++ (2 files their links are posted below) all you have to do is implement the functions as declared
Question) Implement the functions as declared in the header file “Rectangle.h” in a new file “Rectangle.cpp” and submit only this new file. The implementation should include all of the following here (links would be provided scroll down please) Read the question carefully a snapshot of the question is provided.
Main file link - https://www.dropbox.com/s/7exoapaozabsxq8/HW3Main.txt?dl=0
Rectangle file link - https://www.dropbox.com/s/1diu46k0cz8j1mh/RECTANGLE_H.txt?dl=0
Once you are done paste your code here with a screenshot of the output as the answer to this question. Must be in C++
Explanation / Answer
Here is the code for Rectangle.cpp:
// Homework #3 Header File
// **** DO NOT ALTER THIS FILE ****
#include <iostream>
#include "Rectangle.h"
using namespace std;
Rectangle::Rectangle()
{
_width = _height = 0;
_printCharacter = ' ';
}
Rectangle::Rectangle(int width, int height, char printCharacter)
{
SetWidth(width);
SetHeight(height);
SetCharacter(printCharacter);
}
Rectangle::~Rectangle()
{
}
void Rectangle::Print()
{
for(int i = 0; i < _height; i++)
{
for(int j = 0; j < _width; j++)
cout << _printCharacter;
cout << endl;
}
}
void Rectangle::SetWidth(int width)
{
if(width >= 0)
_width = width;
}
void Rectangle::SetHeight(int height)
{
if(height >= 0)
_height = height;
}
void Rectangle::SetCharacter(char printCharacter)
{
_printCharacter = printCharacter;
}
int Rectangle::GetArea()
{
return _width * _height;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.