So I have this vector called members and I want to add all the checkedOutItems from each element of members to the temp vector. I don't think what I'm doing is right? I'm not sure what to do here, cause I can't use push_back right?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
void Library::incrementCurrentDate()
{
++currentDate;
for (int i = 0; i < members.size(); i++)
{
std::vector<LibraryItem*> temp;
temp = members[i]->getCheckedOutItems();
for (int j = 0; j < temp.size(); j++)
{
if ((currentDate - temp[j]->getDateCheckedOut()) > temp[j]->getCheckOutLength())
{
members[i]->amendFine(0.10);
}
}
}
}
You have "members". Each member can have 0 or more "items". Each item has date and CheckOutLength. You want to amend 10 cent fine for each overdue item.
Is that correct?
What does membertype::getCheckedOutItems() return?