Please urgent help

Task: Code Assignment
===============
Provide the definitions for the following class declaration and then write a program that demonstrates usage of each member function using the test data of 10 for width and 8 for height. Remember to put your main program, class header and class source into separate files. This is an easier version of the exercise than the one you have been asked to practice. Only provide code for the methods specified in the class declaration. Note that the displayRectangle() method should output an appropriate ‘box’, its dimensions, area and perimeter to the screen.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Rectangle
{
public:
   Rectangle(int height, int width);
   ~Rectangle(void);
private:
   int height;
   int width;
public:
   int getHeight(void);
   int getWidth(void);
   int calculateArea(void);
   int calculatePerimeter(void);
   void displayRectangle(void);
};
Last edited on
closed account (S6k9GNh0)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Rectangle
{
public:
   Rectangle(int height, int width);
   ~Rectangle(void);
private:
   int height;
   int width;
public:
   int getHeight(void) { return height; }
   int getWidth(void) { return width; }
   int calculateArea(void) { return width*height; }
   int calculatePerimeter(void) { return (width*2)+(height*2); }
   void displayRectangle(void); //Figure this out on your own.
};
Topic archived. No new replies allowed.