#include #include "poolparty.h" #include "guest.h" using namespace std; // ----------------------------------------------------------------- Guest::Guest(std::string const& n) : name{n} { } void Guest::update_answer(Pool_Party const& pp) const { update(pp); } // ----------------------------------------------------------------- void Committed_Guest::update(Pool_Party const&) const { cout << name << ": I'm delighted! Of course I'll come :-D" << endl; } // ----------------------------------------------------------------- void Hesitant_Guest::update(Pool_Party const& pp) const { if ( will_decline(pp) ) { cout << name << ": Sorry, " << get_reason() << endl; } else { cout << name << ": Ohh! Nice, I can make it :-)" << endl; } } // ----------------------------------------------------------------- bool Prude_Guest::will_decline(Pool_Party const& pp) const { return ! pp.is_suit_required(); } std::string Prude_Guest::get_reason() const { return "I have a dentist appointment at that time."; } // ----------------------------------------------------------------- Busy_Guest::Busy_Guest(std::string const& n, int h) : Hesitant_Guest{n}, can_not_before_hour{h} { } bool Busy_Guest::will_decline(Pool_Party const& pp) const { return pp.get_start_hour() < can_not_before_hour; } std::string Busy_Guest::get_reason() const { return "I can not make it until " + to_string(can_not_before_hour) + "!"; }