#include #include "student.h" // implementation of class Student Student::Student(const string & name, int energy) : myName(name), myEnergy(energy) { // work done in intializer list } Student::~Student() { // nothing needed, no dynamic memory allocated } void Student::Eat() // post: student has eaten, energy up { myEnergy += 5; cout << "yum yum, glurp, gobble, burp" << endl; } void Student::Work() // post: student has worked, energy down { myEnergy -= 20; cout << "study study ... panic ... study" << endl; } void Student::Sleep() // post: student has slept, energy up { myEnergy += 10; cout << "Zzzzzzzzzzzzz, resting sleep" << endl; } void Student::BeAlive() // post: student lives { Eat(); Work(); Sleep(); } bool Student::IsAlive() const // post: returns true iff student is still alive { return myEnergy > 0; } string Student::Name() const // post: returns student name { return myName; } int Student::Energy() const // post: returns student energy { return myEnergy; }