#include "Golfer.h"

using namespace std;

   Golfer::Golfer()
   {
      name = "";
      eMail = "";
      handicap = MAX_HANDICAP;
   }

   Golfer::Golfer(string name)
   {
      this->name = name;
      eMail = "";
      handicap = MAX_HANDICAP;
   }
   
   Golfer::Golfer(string _name, string _eMail, int _handicap)
   {
      name = _name;
      eMail = _eMail;
      handicap = _handicap;
   }
   
   string Golfer::getEMail() const
   {
      return eMail;
   }
   
   void Golfer::setEMail(string address)
   {
      eMail = address;
   }
   
   int Golfer::getHandicap() const
   {
      return handicap;
   }
   
   void Golfer::setHandicap(int handicap)
   {
        this->handicap = handicap;
   }  
   
   void Golfer::swap(Golfer &g2)
   {
      Golfer temp = g2;
      g2 = *this;
      *this = temp;
   }
       
   bool Golfer::operator >(Golfer const &rhs) 
   {
      return (handicap < rhs.handicap);
   }
   
   bool Golfer::operator ==(Golfer const &rhs) 
   {
      return (name == rhs.name &&
              eMail == rhs.eMail &&
              handicap == rhs.handicap);
   }


   Golfer::~Golfer()
   {
      cout << "in destructor - name is: " << name << endl;
   }


   
   ostream& operator << (ostream& out, const Golfer &g)
   {
      out << g.getName() << " (" << g.getEMail() << ") - " << g.getHandicap();
      return out;
   }