CreditCard Class Reference

#include <CreditCard.h>

List of all members.

Public Member Functions

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


Detailed Description

Represents a credit card record with a monthly billing cycle


Constructor & Destructor Documentation

CreditCard::CreditCard std::string  no,
std::string  nm,
Money  lim,
double  rt,
Money  bal = Money()
 

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 Money  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

Money 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

Money CreditCard::getCurrentBalance  )  const
 

Return the up-to-the-minute balance.

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

Money CreditCard::getLimit  )  const
 

Return the credit limit.

Returns:
limit expressed in dollars.

Money 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

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

Money 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 Money  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 files:
Generated on Tue Sep 16 23:25:45 2008 by  doxygen 1.4.6