// FILENAME: dogclass.h // ** PRECONDITION: in order for file to be "readable", // the racing program is cut down to one race, & all of the // 2-digit nums in one-eigth & stretch must be truncated // and the race header is also removed. // RACE STRUCTURE Holds the 1 line of information for a dog #ifndef __DOGCLASS_H__ #define __DOGCLASS_H__ #include // Provides external file streams #include // Provides cin, cout, cerr #include // Provides isspace #include // Provides atoi #include // Provides sprintf #include // Provides AnsiString struct Race { float pp,time; int dist, gate, oneeigth, stretch, finish; AnsiString grade; }; // *((**(*((** DOG CLASS **(**(((*(**( // Public Functions // --------------------------- // void getinfo(FILE* &ins); // POSTCONDITION: Fills the class with the necessary race // info & completes the necessary calculations. // Private Helper Functions // --------------------------- // void getname(FILE*& ins, char name[]); // POSTCONDITION: Gets one integer from input file // and returns it to program // void eatspace(FILE*& ins); // POSTCONDITION: Reads and discard "white space" from ins // void eatheader(FILE*& ins); // POSTCONDITION: Discards the 3 line race header (after name) // PRECONDITION: Must call getname first to preserve dog name // void fillrace(FILE*& ins, Race &race); // POSTCONDITION: fills one race from ins // PRECONDITION: ins is qued up to start of race info // void calculate(void); // POSTCONDITION: Avg time, early speed, and // front/back runner info is calculated class Dog { public: Dog::Dog(float record = 30.96, int dist = 1699); Dog::~Dog(); void getinfo(FILE* &ins); int grade(void) { return effective_grade; } char curform(void) { return form; } float closingspeed(void) { return closing; } float speed(void) { return avg_time; } char runstyle(void) { return style; } char runpref(void) { return inout; } float oneeigth(void) { return avg_oneeigth; } int earlyspeed(void) { return early_speed; } void setinout(char let) { inout = let; } void setstyle(char let) { style = let; } void setcharge(float num) { closing = num; } void setspeed(float num) {avg_time = num; } char dogname[43]; private: void getname(FILE*& ins); void eatheader(FILE*& ins); bool fillrace(FILE*& ins, Race &race); void calculate(void); void eatspace(FILE*& ins); void geteffgrade(void); void calcstyle(float early_speed); void calcform(void); int effective_grade; char form, style, inout; float trackrecord; float avg_time; int early_speed, recdist; float avg_oneeigth,avg_finish,closing; Race race[6]; }; #endif