Question: Modify the CreditCard class from Code Fragment 1.2 to include modifier functions that allow a user to modify internal variables in a CreditCard class in

Modify the CreditCard class from Code Fragment 1.2 to include modifier functions that allow a user to modify internal variables in a CreditCard class in a controlled manner.


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; bool Credit Card::chargelt (double price) { if (price + balance > double(limit)) return false; balance + price; return true; } // provides Credit Card // make std:: accessible // standard constructor } void Credit Card::make Payment (double payment) { // make a payment payment; balance } return out; = // make a charge ostream& operator

Step by Step Solution

3.43 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Source Code in Java public class CreditCard Instance Variables private String customer name of the 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!