CreditCard Class Reference

#include <CreditCard.h>

List of all members.

Public Member Functions

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


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,
int  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 limit for card (expressed in dollars)
rt A nonnegative value that represents the monthly interest rate (e.g. 0.0079 for an 0.79% monthly rate)
bal Initial balance for this account (expressed in cents)


Member Function Documentation

bool CreditCard::chargeIt int  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.

Parameters:
price requested amount to be charged (in cents)
Returns:
true if charge was allowed; false if disallowed

int CreditCard::getCurrentBalance  )  const
 

Return the up-to-the-minute balance.

Returns:
up-to-the-minute balance (measured in cents).

int CreditCard::getLimit  )  const
 

Return the credit limit.

Returns:
limit (expressed in dollars)

int CreditCard::getMinPayment  )  const
 

Return the minimum payment ammount that was computed in the most recent call to processMonth.

Returns:
most recently calculated minimum payment (in cents)

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::getRate  )  const
 

Return the interest rate.

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

int CreditCard::getStatementBalance  )  const
 

Return the account balance as it existed at the conclusion of the most recent as of the end of the previous month.

Returns:
balance (measured in cents) as it existed at the end of the most recent call to processMonth

void CreditCard::makePayment int  payment  ) 
 

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

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.)

Negative payments should be ignored.

Parameters:
payment requested amount to be charged (in cents)

int CreditCard::processMonth  ) 
 

This method performs all processing to reflect the typical end of a monthly cycle. 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 (measured in cents)


The documentation for this class was generated from the following files:
Generated on Wed Jan 21 23:22:13 2009 by  doxygen 1.4.6