Question: Modify the CreditCard class from Code Fragment 1.2 to charge interest on each payment. Data from in Fragment 1.2 A typical C++ program includes many

Modify the CreditCard class from Code Fragment 1.2 to charge interest on each payment.


Data from in Fragment 1.2

A typical C++ program includes many different header files, which often include other header files. As a result, the same header file may be expanded many times. Such repeated header expansion is wasteful and can result in compilation errors because of repeated definitions. To avoid this repeated expansion, most header files use a combination of preprocessor commands. Let us explain the process, illustrated in Code Fragment 1.2.

#include "Credit Card.h" using namespace std; Credit Card::Credit Card (const string& no,

#include "Credit Card.h" using namespace std; Credit Card::Credit Card (const string& no, const string& nm, int lim, double bal) { number = no; } name = nm; balance = bal; limit = lim; // provides Credit Card // make std:: accessible // standard constructor bool Credit Card::chargelt (double price) { if (price + balance > double(limit)) return false; balance + price; return true; // make a charge // over limit // the charge goes through } void Credit Card::make Payment (double payment) { // make a payment balance payment; } // print card information ostream& operator

Step by Step Solution

3.33 Rating (168 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

if nd ef CARD H define CARD H include string class Credit Card public C... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Data Structures And Algorithms In C++ Questions!