Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I wanna make simple Credit Card But I have some error the error shows 'Credit card :: Credit card' Override default arguments. Parameter 1 How

I wanna make simple Credit Card

But I have some error

the error shows

'Credit card :: Credit card' Override default arguments. Parameter 1

How to fix it??

Here is code.

#ifndef CREDIT_CARD_H

#define CREDIT_CARD_H

#include

#include

using namespace std;

class CreditCard {

private:

string number;

string name;

int limit;

double balance;

public:

CreditCard(string no, string nm, int lim, double bal = 0);

string getNumber() const { return number; }

string getName() const { return name; }

double getBalance() const { return balance; }

int getLimit() const { return limit; }

bool chargelt(double price);

void makePayment(double payment)

{

balance -= payment;

}

};

std::ostream & operator << (std::ostream & out, const CreditCard & c);

#endif

include "CreditCard.h"

#include

using namespace std;

CreditCard::CreditCard(string no, string nm, int lim, double bal = 0)

{

number = no;

name = nm;

balance = bal;

limit = lim;

}

bool CreditCard::chargelt(double price) {

if (price + balance > double(limit))

return false;

balance += price; ??.

return true;

}

std::ostream & operator << (std::ostream& out, const CreditCard & c) {

out << "Number = " << c.getNumber() << endl

<< "Name = " << c.getName() << endl

<< "Balance = " << c.getBalance() << endl

<< "Limit = " << c.getLimit() << endl;

return out;

}

#include

#include "CreditCard.h"

using namespace std;

void testCard() {

vector wallet(10); //CreditCard??? 10?? ????? ??(??)? ????.

wallet[0] = new CreditCard("5391 0375 9387 5309", "Jonh Bowman", 2500);

wallet[1] = new CreditCard("3485 0399 3395 1954", "Jonh Bowman", 3500);

wallet[2] = new CreditCard("6011 4902 3294 2994", "John Bowman", 5000);

for (int j = 1; j <= 16; j++) {

wallet[0]->chargelt(double(j));

wallet[1]->chargelt(2 * j);

wallet[2]->chargelt((3 * j));

}

cout << "Card payments: ";

for (int i = 0; i < 3; i++) {

cout << *wallet[i];

while (wallet[i]->getBalance() > 100.0) {

wallet[i]->makePayment(100.0);

cout << "New balane = " << wallet[i]->getBalance() << endl;

}

cout << " ";

delete wallet[i];

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions

Question

Assess three steps in the selection process.

Answered: 1 week ago

Question

Identify the steps in job analysis.

Answered: 1 week ago