Question: Hello, i cant seem to figure out why my code wont compile in c + + . The error seems to be pertaining to the

Hello, i cant seem to figure out why my code wont compile in c++. The error seems to be pertaining to the Patron Lib class but i cant figure it out. can you help please. Pics provided due to character limit
ADDITIONAL 2 SECTIONS OF CODE PROVIDED IN TEXT BELOW.
LoanLib.cpp:
#include
#include
#include "LoanLib.h"
void LoanLib::checkOutBook(int bookID, int patronID){
try {
Book book = books.findBook(bookID);
Patron patron = patrons.findPatron(patronID);
if (patron.getCurrentBooksOut()<6 && book.getStatus()=="In"){
Loan newLoan(loans.size()+1, bookID, patronID, time(0)+10*24*60*60, "Normal");
loans.push_back(newLoan);
book.setStatus("Out");
books.editBook(bookID, book);
patron.setCurrentBooksOut(patron.getCurrentBooksOut()+1);
patrons.editPatron(patronID, patron);
} else {
cout << "Cannot checkout book. Limit Reached or book unavailable." << endl;
}
} catch (exception &e){
cout << e.what()<< endl;
}
}
void LoanLib::checkInBook(int loanID){
auto loanIt = find_if(loans.begin(), loans.end(),
[loanID](Loan &l){ return l.getLoanID()== loanID; });
if (loanIt != loans.end()){
Loan loan =*loanIt;
Book book = books.findBook(loan.getBookID());
Patron patron = patrons.findPatron(loan.getPatronID());
book.setStatus("In");
books.editBook(loan.getBookID(), book);
patron.setCurrentBooksOut(patron.getCurrentBooksOut()-1);
patrons.editPatron(loan.getPatronID(), patron);
loans.erase(loanIt);
} else {
cout << "Loan not found!" << endl;
}
}
void LoanLib::OverdueLoans(){
time_t now = time(0);
for (auto &loan : loans){
if (loan.getDueDate()< now){
cout << "Loan ID: "<< loan.getLoanID()<<" is overdue" << endl;
}
}
}
void LoanLib::BooksForPatron(int patronID){
for (auto &loan : loans){
if (loan.getPatronID()== patronID){
cout << "Book ID: "<< loan.getBookID()<< endl;
}
}
}
void LoanLib::updateLoan(){
time_t now = time(0);
for (auto &loan : loans){
if (loan.getDueDate()< now && loan.getStatus()== "Normal"){
loan.setStatus("Overdue");
}
}
}
void LoanLib::recheckBook(int loanID){
auto loanIt = find_if(loans.begin(), loans.end(),
[loanID](Loan &l){ return l.getLoanID()== loanID; });
if (loanIt != loans.end()){
Loan loan =*loanIt;
if (loan.getStatus()== "Normal"){
loan.setDueDate(loan.getDueDate()+10*24*60*60);
} else {
cout << "Cannot recheck overdue book" << endl;
}
} else {
cout << "Loan not found!" << endl;
}
}
void LoanLib::editLoan(int loanID, const Loan &newDetails){
auto loanIt = find_if(loans.begin(), loans.end(),
[loanID](Loan &l){ return l.getLoanID()== loanID; });
if (loanIt != loans.end()){
*loanIt = newDetails;
} else {
cout << "Loan not found!" << endl;
}
}
void LoanLib::reportLostBook(int loanID){
auto loanIt = find_if(loans.begin(), loans.end(),
[loanID](Loan &l){ return l.getLoanID()== loanID; });
if (loanIt != loans.end()){
Loan loan =*loanIt;
Book book = books.findBook(loan.getBookID());
Patron patron = patrons.findPatron(loan.getPatronID());

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!