//********************************************************* // Header file bowlingAlley.h for the bowlingAlley class. // Array-based implementation. // Programming Project 1 // CS 241 Data Structures // Fall 2003 //********************************************************* #include // See Carrano et al., pp. A32-A34. #include "bowlingExceptions.h" #ifndef BOWLINGALLEY_H #define BOWLINGALLEY_H const int NUM_LANES = 10; class bowlingAlley { public: // constructor bowlingAlley(); // Prints to standard output a message that // the constructor has been called. // querying functions bool isBowling(const string& group) const; // Returns true if the group has been assigned a lane in the // bowlingAlley; false otherwise. bool isEmpty() const; // Determines whether or not the bowlingAlley is empty. Returns // true if the bowlingAlley is empty; otherwise, returns false. int numberOfBowlingGroups() const; // Returns the number of groups bowling in the bowlingAlley. void displayGroups() const; // Displays the names of the groups in the bowlingAlley. // functions that modify the class void assignGroup(const string& newGroup) throw(bowlingAlleyFull, duplicateGroup); // If possible, assigns newGroup a lane in the bowlingAlley. // bowlingAlleyFull is thrown if the bowling alley is full. // duplicateGroup is thrown if newGroup has already been assigned a // lane. If both conditions are true, duplicateGroup is thrown. In // all other cases, newGroup will be assigned a lane. void removeGroup(const string& group) throw(groupNotPresent); // If group was assigned a lane in the bowlingAlley, drop the name // of the group from the list of assigned groups. groupNotPresent // is thrown if the group has not been assigned a lane. private: int numberOfGroups; string lanes[NUM_LANES]; }; // end class bowlingAlley #endif