// This is the test program and question description for SYSC 2002 lab test #3 version 2 // You are to write and submit files "SwimStats.h" and "SwimStats.cpp". // The following code and the sample executable should make it clear as to what methods // are required and what they do. You must, of course, create the necessary fields // for your class. // Note that version #2 of the Date class (Date.h and Date.cpp) is provided for reference. #include "stdstuff.h" #include "SwimStats.h" int main () { SwimStats biedermann, phelps(8,1,2,0), cavic(0,2,3,1); // biedermann has no wins, no other medals (i.e. 2nds and 3rds), // no other final placings (i.e. 4th-8th places), and no other placings (i.e. 9th plus) // phelps has 8 wins, 1 other medal (i.e. 2nds and 3rds), // 2 other final placings (i.e. 4th-8th places), and no other placings (i.e. 9th plus) // cavic has no wins, 2 other medals (i.e. 2nds and 3rds), // 3 other final placings (i.e. 4th-8th places), and 1 other placing (i.e. 9th plus) biedermann.win(); // biedermann wins a race! phelps.medal(); // phelps places 2nd or 3rd cavic.final(); // cavic makes the final 8, but doesn't medal (i.e. 4th-8th place) biedermann.win(); // biedermann wins again! cout << "Biedermann's record is (should be 2-0-0-0): "; biedermann.printStats(); // prints "2-0-0-0" (i.e. biedermann has 2 wins and // no other placings cout << "\nPhelps' record is (should be 8-2-2-0) : "; phelps.printStats(); // prints "8-2-2-0" (i.e. phelps has 8 wins, 2 2nd-3rds, // 2 4th-8ths, and no worse placings cout << "\nCavic's record is (should be 0-2-4-1): "; cavic.printStats(); // prints "0-2-4-1" (i.e. cavic has 0 wins, 2 2nd-3rds, // 4 4th-8th, and 1 9th+) cout << "\n\n"; phelps.win(); // phelps wins! cavic.medal(); // cavic places 2nd or 3rd biedermann.noFinal(); // biedermann doesn't make the final (i.e. 9th or slower) cout << "Biedermann's record is (should be 2-0-0-1): "; biedermann.printStats(); // prints "2-0-0-1" (i.e. biedermann has 2 wins and 1 9th+ cout << "\nPhelps' record is (should be 9-2-2-0) : "; phelps.printStats(); // prints "9-2-2-0" (i.e. phelps has 9 wins, 2 2nd-3rds, // 2 4th-8ths, and no worse placings cout << "\nCavic's record is (should be 0-3-4-1): "; cavic.printStats(); // prints "0-3-4-1" (i.e. cavic has 0 wins, 3 2nd-3rds, 4 4th-8th, and 1 9th+) cout << "\n\n"; cout << "Biedermann has won: " << biedermann.numGolds() << " gold medals. (Should be 2.)\n"; cout << "Phelps has won: " << phelps.numGolds() << " gold medals. (Should be 9.)\n"; cout << "Cavic has won: " << cavic.numGolds() << " gold medals. (Should be 0.)\n\n"; if (biedermann.moreMedals()) cout << "CORRECT: Biedermann has won medals [1st-3rd] in more than half his races.\n"; else cout << "INCORRECT: Biedermann has not won medals [1st-3rd] in more than half his races.\n"; if (cavic.moreMedals()) cout << "INCORRECT: Cavic has won medals [1st-3rd] in more than half his races.\n"; else cout << "CORRECT: Cavic has not won medals [1st-3rd] in more than half his races.\n"; if (phelps.moreMedals()) cout << "CORRECT: Phelps has won medals [1st-3rd] in more than half his races.\n\n"; else cout << "INCORRECT: Phelps has not won medals [1st-3rd] in more than half his races.\n\n"; if (biedermann.moreGoldsThan(cavic)) cout << "CORRECT: Biedermann has more golds than Cavic.\n"; else cout << "INCORRECT: Biedermann does not have more golds than Cavic.\n"; if (cavic.moreGoldsThan(phelps)) cout << "INCORRECT: Cavic has more golds than Phelps.\n\n"; else cout << "CORRECT: Cavic does not have more golds than Phelps.\n\n"; // Note that a swimmer gets 10 points for a win, 5 for 2nd-3rd, 1 for 4th-8th, and 0 for 9th+ cout << "Phelps has: " << phelps.score() << " points. (Should be 102.)\n"; cout << "Cavic has: " << cavic.score() << " points. (Should be 19.)\n"; cout << "Biedermann has: " << biedermann.score() << " points. (Should be 20.)\n\n"; pause (); return 0; }