// This is the test program and question description for SYSC 2002 lab test #3 version 1 // You are to write and submit files "StudentMarks.h" and "StudentMarks.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 "StudentMarks.h" int main () { StudentMarks siva(3,2,4,1), mary, mo(10,1,2,0); // siva has 3 As, 2 Bs, 4 Cs, and 1 other mark // mary has no As, no Bs, no Cs, and no other marks // mo has 10 As, 1 B, 2 Cs, and no other marks mary.gotA(); // mary got an A! siva.gotB(); // siva got a B mo.gotC(); // mo got a C cout << "Mary's marks are (should be 1-0-0-0): "; mary.printMarks(); // prints "1-0-0-0", i.e. mary has 1 A and no other marks cout << "\nMo's marks are (should be 10-1-3-0) : "; mo.printMarks(); // prints "10-1-3-0", i.e. mo has 10 As, 1 B, 3 Cs, and no other marks cout << "\nSiva's marks are (should be 3-3-4-1): "; siva.printMarks(); // prints "3-3-4-1", i.e. siva has 3 As, 3 Bs, 4 Cs, and 1 other mark cout << "\n\n"; mo.gotA(); // mo got an A! mary.gotC(); // mary got a C siva.gotB(); // siva got a B mary.gotOther(); // mary got an "other" (lower than C) mark cout << "Mary's marks are (should be 1-0-1-1): "; mary.printMarks(); // prints "1-0-1-1", i.e. mary has 1 A, 0 Bs, 1 C, and 1 other mark cout << "\nMo's marks are (should be 11-1-3-0) : "; mo.printMarks(); // prints "11-1-3-0", i.e. mo has 11 As, 1 B, 3 Cs, and no other marks cout << "\nSiva's marks are (should be 3-4-4-1): "; siva.printMarks(); // prints "3-4-4-1", i.e. siva has 3 As, 4 Bs, 4 Cs, and 1 other mark cout << "\n\n"; cout << "Mo has: " << mo.numAs() << " As. (Should be 11.)\n"; cout << "Siva has: " << siva.numAs() << " As. (Should be 3.)\n"; cout << "Mary has: " << mary.numAs() << " As. (Should be 1.)\n\n"; if (siva.mostAboveC()) cout << "CORRECT: More than half of Siva's marks are better than C.\n"; else cout << "INCORRECT: Less than or equal to half of Siva's marks are not better than C.\n"; if (mary.mostAboveC()) cout << "INCORRECT: More than half of Mary's marks are better than C.\n"; else cout << "CORRECT: Less than or equal to half of Mary's marks are better than C.\n"; if (mo.mostAboveC()) cout << "CORRECT: More than half of Mo's marks are better than C.\n\n"; else cout << "INCORRECT: Less than or equal to half of Mo's marks are better than C.\n\n"; if (mary.asManyAs(mo)) cout << "INCORRECT: Mary has at least as many As as Mo.\n"; else cout << "CORRECT: Mary has fewer As than Mo.\n"; if (mo.asManyAs(siva)) cout << "CORRECT: Mo has at least as many As as Siva.\n\n"; else cout << "INCORRECT: Mo has fewer As than Siva.\n\n"; // Academic score calculated as 3 for each A, 2 for each B, 1 for each C, // and 0 for each other mark cout << "Mo's academic score is: " << mo.acadScore() << " points. (Should be 38.)\n"; cout << "Siva's academic score is: " << siva.acadScore() << " points. (Should be 21.)\n"; cout << "Mary's academic score is: " << mary.acadScore() << " points. (Should be 4.)\n\n"; pause (); return 0; }