Question
Please help me with these short answer questions for c++ rectangle.h file #ifndef RECTANGLE_H #define RECTANGLE_H const int MINIMUMSIZE=1; // Minsize const int MAXIMUMSIZE=39; //
Please help me with these short answer questions for c++
rectangle.h file
#ifndef RECTANGLE_H
#define RECTANGLE_H
const int MINIMUMSIZE=1; // Minsize
const int MAXIMUMSIZE=39; // Maxsize
const int DEFAULTSIZE=1; // Default size
const char DEFAULTBORDER='#'; // Default border
const char DEFAULTFILL='*'; // Default fill
const char MINIMUMCHAR='!'; // Minimum char
const char MAXIMUMCHAR='~'; // Maximum char
namespace Rectangle1 {
class Rectangle {
public:
Rectangle(); // Default Constructor
Rectangle(int s, char b=DEFAULTBORDER, char f=DEFAULTFILL);
Rectangle(Rectangle & b);
Rectangle & operator =(const Rectangle & b);
~Rectangle();
char Getborder();
char Getfill();
int Getsize();
void setborder ( const char b);
void setfill ( const char f);
void setsize ( const int s);
int GetPerimeter();
int GetArea();
void Grow();
void Shrink();
void Summary();
void Draw();
private:
int size;
char fill;
char border;
};
}
#endif
For these questions: refer to the header file
-
Write the default (no parameters) for the Rectangle class constructor code to initialize the rectangle size to 1. The border character to # and fill the character to a *. This would be the code to go into the rectangle.cpp file.
-
Declare a Rectangle object called MyRectangle1 with size 5, border of& and fill of $.
-
Declare a Rectangle object called MyRectangle2 with size 39, border of ^, and no fill character (let it default)
-
Declare a Rectangle object called MyRectangle3 with size 10 with no border and no fill (let them default).
-
Declare a Rectangle object called MyRectangle4 with no parameters (default constructor).
-
Below is a prototype for an increment function for the Rectangle class. Write a code that would go into the rectangle.cpp file where you pass in a positive integer that will cause the rectangle to grow by that size up to the maximum. If you do not pass in an integer, the default will be one. You may call the Grow() function in implementation.
-
void Increment (const int X=1); .h file prototype
-
-
Below is a prototype for a decrement function for the Rectangle class. Write a code that would go into the rectangle.cpp file where you pass in a positive integer that will cause the rectangle to shrink by that size down to the minimum. If you do not pass in an integer, the default will be one. You may call the Shrink() function in implementation.
-
void Decrement (const int X=1);
-
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