The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Modify the CreditCard class from Code Fragment 1.3 to check that the price argument passed to function chargeIt and the payment argument passed to function makePayment are positive.
#include "CreditCard.h"// provides CreditCardusing namespace std;// make std:: accessible // standard constructorCreditCard::CreditCard(const string& no, const string& nm, int lim, double bal) { number = no; name = nm; balance = bal; limit = lim; }  // make a chargebool CreditCard::chargeIt(double price) { if (price + balance > double(limit)) return false;// over limitbalance += price; return true;// the charge goes through} void CreditCard::makePayment(double payment) {// make a paymentbalance −= payment; }  // print card informationostream& operator<<(ostream& out, const CreditCard& c) { out << "Number = "<< c.getNumber()<< "\n"<< "Name = "<< c.getName()<< "\n"<< "Balance = "<< c.getBalance()<< "\n"<< "Limit = "<< c.getLimit()<< "\n";return out;  } Â
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll