C++ Sqaure Class

Hi, I'm having trouble with this square class. I want to write a C++ class Square whose objects are squares having the sides parallel to the coordinate
axes xOy in the plane.
(a) The class must have several constructors, including a copy constructor.
(b) The class must contain member functions computing the area and the perimeter of a square.
(c) The class must contain member functions checking
• whether the square is external to another;
• whether the square contains another square;
• whether the square is contained into another square;
• whether the square is tangent externally to another square (that is, whether their borders
are in contact but, except those border points, they are external to each other);
• whether the square is tangent internally to another square (that is, they have points on the
borders in common but, except those border points, one square is contained into the other
one);
• whether the border of the square intersects the border of another square.

My main problem is the member functions. Any tips or help is appreciated.
bump
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include  <iostream>
#include  <cmath>
#include "Square.cc"
class Square
{
	private:
		int len,wid;
		double x,y;

	public:
		int Area () {return (len*wid);}
		int Perimeter () {return ((2*len)+(2*wid));}
		Square ( ): x(0.0), y(0.0) { }
		Square (double a, double b): x(a), y(b) { }
		Square (const Square&  s) {  x = s.x;  y = s.y;  }
		double  getX( )  const {  return x;  }
		double  getY( )  const {  return y;  }
		void  setX (double  x) {  this->x = x;  }
		void  setY (double  y) {  this->y = y;  }
		double  distanceTo (const  Square&  s);
		bool  contains (const  Square&  a)  const;
		void  print ( )  const;

	
}sqr;
Topic archived. No new replies allowed.