Main Page | Class List | File List | Class Members

CreditCard Class Reference

#include <CreditCard.h>

List of all members.

Public Member Functions

 CreditCard (std::string no, std::string nm, int lim, double rt, double bal=0)
std::string getNumber () const
std::string getName () const
int getLimit () const
double getRate () const
double getCurrentBalance () const
double getPreviousBalance () const
int getMinPayment () const
bool chargeIt (double price)
void makePayment (double payment)
int endOfMonth ()


Detailed Description

Represents a credit card record with a monthly billing cycle


Constructor & Destructor Documentation

CreditCard::CreditCard std::string  no,
std::string  nm,
int  lim,
double  rt,
double  bal = 0
 

Construct a new credit card.

Parameters:
no the credit card number (expressed as a string)
nm the card-holder's name
lim maximum dollar limit for card
rt A fraction which represents the monthly interest rate
bal Initial balance for this account


Member Function Documentation

bool CreditCard::chargeIt double  price  ) 
 

Attempts to make a charge of given price against this card.

A charge should be disallowed if it would cause the credit limit to be exceeded.

All negative charges should be disallowed (instead, they should be processed by making a payment)

Returns:
true if charge was allowed; false if disallowed

int CreditCard::endOfMonth  ) 
 

This method is called to signify the end of a billing month. It is used to assess any fees or interest which are incurred and to record a new minimum payment required for the coming month.

return the new minimum payment required

double CreditCard::getCurrentBalance  )  const
 

Return the up-to-the-minute balance.

Returns:
up-to-the-minute balance, in dollars (or fraction theoreof).

int CreditCard::getLimit  )  const
 

Return the credit limit.

Returns:
limit expressed in dollars.

int CreditCard::getMinPayment  )  const
 

Return the minimum payment ammount that was reported at the end of the previous month.

Returns:
minimum payment that was requested at end of previous month

std::string CreditCard::getName  )  const
 

Return the name of the card holder.

Returns:
person's name as a string

std::string CreditCard::getNumber  )  const
 

Return the card number.

Returns:
string representing the card number

double CreditCard::getPreviousBalance  )  const
 

Return the account balance which was reported as of the end of the previous month.

Returns:
balance as was calculated at end of previous month

double CreditCard::getRate  )  const
 

Return the interest rate.

Returns:
monthly interest rate (e.g. 0.0079 for 0.79% monthly rate)

void CreditCard::makePayment double  payment  ) 
 

Used to make a payment on behalf of the account holder.

Negative payments should be ignored.

A positive payment is used to pay off a portion of the current balance. (if user pays off more than their current balance, the excess should still be credited in the form of a negative balance.)


The documentation for this class was generated from the following file:
Generated on Tue Jan 23 15:52:49 2007 by doxygen 1.3.4