Question: Modify the CreditCard class from Code Fragment 1.3 to check that the price argument passed to function charge It and the payment argument passed to
Modify the CreditCard class from Code Fragment 1.3 to check that the price argument passed to function charge It and the payment argument passed to function make Payment are positive.
Data from in Fragment 1.3
The file CreditCard.cpp, which contains the definition of the out-of-class member functions for class CreditCard.


#include #include "Credit Card.h" // provides STL vector // provides Credit Card, cout, string // make std accessible // Credit Card test function // vector of 10 Credit Card pointers // allocate 3 new cards wallet [0] = new Credit Card ("5391 0375 9387 5309", "John Bowman", 2500); wallet [1] = new Credit Card ("3485 0399 3395 1954", "John Bowman", 3500); wallet [2] = new Credit Card ("6011 4902 3294 2994", "John Bowman", 5000); using namespace std; void test Card() { vector wallet (10); for (int j=1; j chargelt (double(j)); wallet [1]->chargelt(2* j); wallet [2]->chargelt (double (3 * j)); } // make some charges // explicitly cast to double // implicitly cast to double
Step by Step Solution
3.36 Rating (162 Votes )
There are 3 Steps involved in it
The CreditCard class from Code Fragment 13 should be modified to check that the price argument pa... View full answer
Get step-by-step solutions from verified subject matter experts
