Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

  1. 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.

  2. Declare a Rectangle object called MyRectangle1 with size 5, border of& and fill of $.

  3. Declare a Rectangle object called MyRectangle2 with size 39, border of ^, and no fill character (let it default)

  4. Declare a Rectangle object called MyRectangle3 with size 10 with no border and no fill (let them default).

  5. Declare a Rectangle object called MyRectangle4 with no parameters (default constructor).

  6. 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.

    1. void Increment (const int X=1); .h file prototype

  7. 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.

    1. void Decrement (const int X=1);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

Which month has the lowest average percentage of returned sales?

Answered: 1 week ago

Question

What is the average percentage of returned sales for Oklahoma (OK)?

Answered: 1 week ago