C++ Question. /**************************** The lab is below. However, I just ne
ID: 3841272 • Letter: C
Question
C++ Question.
/****************************
The lab is below. However, I just need the class declaration for CreditCard class. Do not include any member function code including inline functions. Use const as appropriate. Please help due in 2hours.
****************************/
Theme issues: Class declaration, constructors, destructors, other member functions
CreditCard Class
Member variables
-credit card number (string)
-previous balance (double). This amount incurs interest.
-new charges (double)
-interest rate as a decimal (double)
+Default constructor giving credit card 0000000000000000 (16 zeroes), previous balance, new charges, and interest rate values of 0.0
+Constructor given only credit card number and interest rate. It will initialize previous balance and new charges to zero.
+Constructor with all
+Destructor
+Mutator functions to set each of the member variables with a value
+Accessor functions to return each of the values stored in the member variables
+Function to add to the new charges
-F unction to compute amount owing (previous balance + interest + new charges)
-Function to compute minimum payment (10% of amount owing or $15 or full amount owing if < $15)
+Function to generate statement (calls private function)
+Function to accept payment and update new charges and previous balance
In addition to implementing the class, driver function main() must perform the following:
Declaration:
Declare an instance of CreditCard with #1234567887654321 and interest rate of 1.6%
Input: Ask the user for the credit card number, initial balance on this card, and monthly interest rate. Declare new object with this info or update previous object.
Processes:
Call a function menu that gives the users the options of
Print to screen – Output the credit card #, previous balance, new charges, and interest rate.
Quit – End the program
New charges – Ask the user for the amount and update new charges in the object accordingly
Generate Statement For this option output to the user the amount owing and the amount of the minimum payment.
Pay For this option output to the user the amount owing and the amount of the minimum payment. Then ask the user the amount of money he/she will pay. Update the amount of the previous balance accordingly.
Test case:
Beginning balance $400; interest rate 1.5% (Print to screen)
New charges $ 25; new charges $75 (Print to screen)
Pay minimum balance (Print to screen)
Pay $200 (Print to screen)
CreditCard Class
Member variables
-credit card number (string)
-previous balance (double). This amount incurs interest.
-new charges (double)
-interest rate as a decimal (double)
+Default constructor giving credit card 0000000000000000 (16 zeroes), previous balance, new charges, and interest rate values of 0.0
+Constructor given only credit card number and interest rate. It will initialize previous balance and new charges to zero.
+Constructor with all
+Destructor
+Mutator functions to set each of the member variables with a value
+Accessor functions to return each of the values stored in the member variables
+Function to add to the new charges
-F unction to compute amount owing (previous balance + interest + new charges)
-Function to compute minimum payment (10% of amount owing or $15 or full amount owing if < $15)
+Function to generate statement (calls private function)
+Function to accept payment and update new charges and previous balance
Explanation / Answer
class CreditCard{
private:
string cardNum;
double prevBal;
double newCharges;
double interestRate;
public:
CreditCard(); //default constructor to initialise cardNum
CreditCard(string ccNum, double intRt); //to set prevBal & new charges to 0
~CreditCard();
//Mutator functions:-
void setcardNum() const;
void setprevBal() const;
void setnewCharges() const;
void setinterestRate() const;
//Accessor functions:-
string getcardNum();
double getprevBal();
double getnewCharges();
double getinterestRate();
double addnewCharges();
double computeAmount();
double computeMinPay();
void generateStatement();
void acceptPay();
};
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.