本文整理汇总了C++中Patron::amendFine方法的典型用法代码示例。如果您正苦于以下问题:C++ Patron::amendFine方法的具体用法?C++ Patron::amendFine怎么用?C++ Patron::amendFine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patron
的用法示例。
在下文中一共展示了Patron::amendFine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: incrementCurrentDate
/*******************************************************
**incrementCurrentDate Description:
** increment current date; increase each Patron's fines
** by 10 cents for each overdue Book they have
** checked out (using amendFine)
** If a book is checked out on day 0, then on day 1,
** the patron has had it for 1 day. On day 21, the
** patron has had it for 21 days, so it is still not
** overdue. On day 22, the book is overdue and
** fines will be charged.
*******************************************************/
void Library::incrementCurrentDate()
{
//increment currentDate first//
currentDate++;
//loop through Patrons//
for (unsigned int pIndex = 0; pIndex < members.size(); pIndex++)
{
//set local pointer and vector only if the//
//Patron has at least one Book checked out//
if (members[pIndex]->getCheckedOutBooks().size() > 0)
{
Patron* pPtr = members[pIndex];
vector<Book*> bVector = pPtr->getCheckedOutBooks();
//loop through Patron's checkedOut Books//
for (unsigned int bIndex = 0; bIndex < bVector.size(); bIndex++)
{
//initiate local variables//
int date = bVector[bIndex]->getDateCheckedOut();
int chOutDate = bVector[bIndex]->getCheckOutLength();
//add fine if Book is overdue//
if (currentDate > chOutDate + date)
pPtr->amendFine(.10);
}
}
}
}