// This is the test program and question description for SYSC 2002 sample lab test #3 // You are to write and submit files "CreditCard.h" and "CreditCard.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 member variables (fields) for your CreditCard class. // Note that version #2 of the Date class (Date.h and Date.cpp) is provided on the G: drive for reference. #include "stdstuff.h" #include "CreditCard.h" int main () { CreditCard ahmed, louise(1000), bala(500); // Ahmed's credit card has a credit limit of the default amount, i.e. $1500 // Louise's credit card has a credit limit of $1000 // Bala's credit card has a credit limit of $500 louise.purchase(500); // Louise used her credit card to purchase an item for $500; she now has $500 more to spend bala.purchase(200); // Bala used his credit card to purchase an item for $200; he now has $300 more to spend ahmed.purchase(1100); // Ahmed used his credit card to purchase an item for $1100; he now has $400 more to spend bala.purchase(1000); // as Bala has only $300 left to spend on his credit card, this purchase is rejected and thus // this line of code has no effect, i.e. Bala still has just $300 more to spend cout << "Louise's credit card limit is $"; louise.creditLimit(); // should print 1000 cout << ".\nAhmed's credit limit is $"; ahmed.creditLimit(); // should print 1500 cout << ".\nBala's credit limit is $"; bala.creditLimit(); // should print 500 cout << ".\n\n"; cout << "The amount of money that Louise can still spend is $" << louise.creditLeft() << ".\n"; // louise.creditLeft() should return 500 cout << "The amount of money that Ahmed can still spend is $" << ahmed.creditLeft() << ".\n"; // ahmed.creditLeft() should return 400 cout << "The amount of money that Bala can still spend is $" << bala.creditLeft() << ".\n\n"; // bala.creditLeft() should return 300 louise.payUp(); // Louise has paid in full. Her credit limit is increased by $100 for being a good customer. bala.payUp(); // Bala has paid in full. His credit limit is increased by $100 for being a good customer. ahmed.payUp(); // Ahmed has paid in full. His credit limit is increased by $100 for being a good customer. // Note that each credit card owner's credit limit has been increased by $100. cout << "Louise's credit card limit is $"; louise.creditLimit(); // should print 1100 cout << ".\nAhmed's credit limit is $"; ahmed.creditLimit(); // should print 1600 cout << ".\nBala's credit limit is $"; bala.creditLimit(); // should print 600 cout << ".\n\n"; // As no one has made any purchases since paying their balance, the amount of money left is equal to the credit limit. cout << "The amount of money that Louise can still spend is $" << louise.creditLeft() << ".\n"; // louise.creditLeft() should return 1100 cout << "The amount of money that Ahmed can still spend is $" << ahmed.creditLeft() << ".\n"; // ahmed.creditLeft() should return 1600 cout << "The amount of money that Bala can still spend is $" << bala.creditLeft() << ".\n\n"; // bala.creditLeft() should return 600 if (bala.sameLimit(louise)) cout << "Bala and Louise have the same credit limit.\n"; else cout << "Bala and Louise do not have the same limit.\n"; pause (); return 0; }