Question: C++ The data members for struct CreditCard are given below. Write its default and explicit constructors. Assume that all necessary includes have been done. A].

C++

The data members for struct CreditCard are given below. Write its default and explicit constructors. Assume that all necessary includes have been done.

A]. Default constructor must initialize various data members as below:

firstName to a value First Name not set.

lastName to a value Last Name not set.

CCN to 0

Balance to 0.0

CreditLimit to 1500.00.

You can set a global constant for credit limit. Global constants are visible throughout the program after the line of their declaration.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct CreditCard

{

string firstName;// Customer first name

string lastName; // Customer last name

int CCN; // Credit Card Number

double balance;// Positive if customer owes the

not exceed this value

CreditCard( )// Default constructor

{

// Fill in the body of default constructor. Use values given in item A above to initialize data members

}

//Fill in the body of explicit constructor below. Set balance to zero and CreditLimit to 1500.00

CreditCard(string fname, string lname, int cardNum)

{

//fname initializes the customer firstName

//lname initializes the customer lastName

//cardNum initializes the CCN

}

};// end of struct CreditCard

Instructor initials on completion:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!