// file point.cpp
// used as part of Classes lab
// contents:  class Point
//	space to insert class Rectangle
//	main() to test classes

#include <iostream.h>


// ********************************************************************
//  Declaration of class Point
// ********************************************************************

// class Point represents a two-dimensional point
class Point
{
public:
  // default class constructor (with no arguments):
  Point(); 

  // class constructor that sets the coordinates x, y to the values xval,
  // yval:
  Point(int xval, int yval);

  // member function for moving a point by dx, dy:
  void Move(int dx, int dy);

  // member functions for getting values of x, y:
  int Get_X() const;
  int Get_Y() const;

  // member functions for setting x, y to xval, yval respectively  
  void Set_X(int xval);
  void Set_Y(int yval);

//Lab exercise 1. Add declaration of member function Print here:

// private data members x, y represent coordinates of the point:
private:
  int X;
  int Y;
};  


// ********************************************************************
//  Methods for class Point
// ********************************************************************

// class constructor sets X, Y to zero when no values are specified:
Point::Point()
{
  X = 0;
  Y = 0;
}

// class constructor sets X, Y to given values xval, yval:
Point::Point(int xval, int yval)
{
  X = xval;
  Y = yval;
}

// member function Move: increases the x coordinate by dx and the y
// coordinate by dy.
void Point::Move(int dx, int dy)
{
  X += dx;
  Y += dy;
}

// Get_X returns the value of the X coordinate
int Point::Get_X() const
{
  return X;
}

// Get_Y returns the value of the Y coordinate
int Point::Get_Y() const
{
  return Y;
}

// Set_X sets the value of X coordinate to xval
void Point::Set_X(int xval)
{
  X = xval;
} 

// Set_Y sets the value of Y coordinate to yval
void Point::Set_Y(int yval)
{
  Y = yval;
} 
    

//Lab exercise 1. Add definition of member function print:


// ********************************************************************
//  Declaration of class Rectangle
// ********************************************************************

//Lab exercise 2: Add class Rectangle declaration HERE:

// ********************************************************************
//  Methods for class Rectangle
// ********************************************************************

//Lab exercise 2. Add class Rectangle methods HERE:



// ********************************************************************
//  main() function for testing classes Point and Rectangle
// ********************************************************************



// Testing classes Point and Rectangle
int main()
{
    // Declaring a point using default class constructor (x = y = 0):
    Point p1;
    std::cout<< "The x value for p1 is " << p1.Get_X() << std::endl;
    std::cout<< "The y value for p1 is " << p1.Get_Y() << std::endl;
    
    // Declaring a point with coordinates X = 2, Y = 3:
    Point p2(2, 3);
    std::cout<< "The x value for p2 is " << p2.Get_X() << std::endl;
    std::cout<< "The y value for p2 is " << p2.Get_Y() << std::endl;
    
    // Moving point p2 by (1, -1):
    p2.Move(1, -1);
    std::cout<< "After the move:" << std::endl;
    std::cout<< "The x value for p2 is " << p2.Get_X() << std::endl;
    std::cout<< "The y value for p2 is " << p2.Get_Y() << std::endl;
    
    //Lab exercise 1. Test member function print on points p1, p2:
    p1.Print();
    std::cout<<std::endl;
    p2.Print();
    //Lab exercise 2. Testing of the class Rectangle goes here:
    
    Rectangle r1;
    std::cout<< "The values for r1 is " << std::endl;
    r1.Print();
    
    std::cout<< std::endl;
    Rectangle r2(p1,p2);
    std::cout<< "The values for r2 is " << std::endl;
    r2.Print();
    
    
    return 0;
}

//---------------------- point.cpp ------------------------------------//

