Write a C++ Program with Object-Oriented features like Operator Overloading and friend function for the following task:
In an Academic Institute, the Students, Research Scholars, and Faculty will borrow books from the Library. Assume for students the due date is 14 days, Research Scholars 21 days, and Faculty 28 days to return their borrowed books.
For the sake of better programming assume that Student Id starts with S, Research Scholars Id starts with R, and Faculty Id starts with F.
Write an appropriate method to display the due date based on the category and calculate the penalty for the defaulter based on the late return date/submission. For every late submission day Rs. 5 will be added to their penality amount.
Ex:
Name: Raja ID: S20BCE1123 Book Issue Date: 10.11.2021 Return Date: 22.11.2021 Penality: Nil
Name: Rani ID: F21CSE1234 Book Issue Date: 01.11.2021 Return Date: 22.11.2021 Penality: Nil
#include <iostream>
using namespace std;
class Library {
private:
string id;
int r_days;
string b_date;
string r_date;
int diff;
public:
Library(string i,int rd,string bd,string rt,int d)
{
id=i;
r_days=rd;
b_date=bd;
r_date=rt;
diff=d;
}
friend Library operator+(Library&, Library&);
};
Library operator+(Library& d1, Library& d2)
{
}
int main()
{
return 0;
}
Comments
Leave a comment