customer.cpp

#include "customer.h"

#include <iostream>

using namespace std;

bool Customer::purchase(const string toBuy)

{

bool success = m_num_purch < MAX_PURCHS;

if (success)

m_purch[m_num_purch++] = toBuy;

return success;

}

void Customer::print() const

{

cout << m_name << " has $" << m_money << " and purchases: ";

if (m_num_purch == 0)

cout << "none";

for (int i=0; i<m_num_purch; i++)

cout << m_purch[i] << ((i < m_num_purch - 1)?", ":"");

cout << endl;

return;

}