// ferry.h // ---------------------------------------------------------------------- // // CSE 143 // Homework 4 // http://www.cs.washington.edu/education/courses/143/00su/homework/ // 21 Jul 2000, Ken Yasuhara #ifndef _FERRY_H_ #define _FERRY_H_ #include #include "car.h" class Ferry { public: Ferry(const int arrivalTime, const int timeBetweenArrivals, const int carCapacity, const int personCapacity); // return max. number of cars/people this ferry can carry int getCarCapacity() const { return carCapacity; } int getPersonCapacity() const { return personCapacity; } // return number of additional cars/people this ferry can carry; // counts go down as boarding progresses via method board int getRemainingCarCapacity() const { return getCarCapacity() - carCount; } int getRemainingPersonCapacity() const { return getPersonCapacity() - personCount; } // returns time at which this ferry arrived at the dock int getArrivalTime() const { return arrivalTime; } // returns the time interval between consecutive landings of this // ferry line int getTimeBetweenArrivals() const { return timeBetweenArrivals; } // returns true iff given car and its passengers can fit bool canFit(const Car *carPtr) const; // records boarding of this car and its passengers; returns false // if there isn't enough room bool board(const Car *carPtr); private: // disallow default construction, copy construction, assignment, // not only in client code, but also inside methods Ferry() { assert(false); } Ferry(const Ferry &otherFerry) { assert(false); } Ferry &operator=(const Ferry &otherFerry) { assert(false); return *this; } int carCapacity, carCount; int personCapacity, personCount; int arrivalTime, timeBetweenArrivals; }; #endif // _FERRY_H_