Group Task
Group Task
CAMPUS KAMRA
SUBMITTED BY:
KHAWAJA MOIN UDDIN 235137
TALAL TARIQ 235154
SUBMITTED TO:
MUHAMMAD KAMRAN
Code:
#include<iostream>
#include<vector>
#include<ctime>
#include<windows.h>
#include<cstdlib>
#include<conio.h>
using namespace std;
void loading()
{
cout<<"Loading..."<<endl;
for(int i=0;i<15;i++)
{
cout<<"*";
Sleep(100);
}
cout<<endl;
}
class Book
{
protected:
string title;
string author;
string isbn;
bool isavailable;
public:
Book(string title=" ",string author=" ",string isbn=" ")
{
this->title=title;
this->author=author;
this->isbn;
isavailable=true;
}
virtual string get_details()
{
string s,available;
available=(this->isavailable)?"True":"False";
s="Title: "+title+"\t\tAuthor: "+author+"\tISBN: "+isbn+"\
tAvaliable: "+available;
return s;
}
bool getavailablity()
{
return isavailable;
}
string getISBN()
{
return isbn;
}
virtual void borrow_book()=0;
virtual void return_book()=0;
};
};
class Member
{
private:
string name;
string id;
vector<Book*> borrowedbooks;
l.addbook(new Fiction("To Kill a Mockingbird ", "Harper Lee", "084", "Southern Gothic"));
l.addbook(new Fiction("The Great Gatsby ", "F. Scott ", "565", "Tragedy"));
// l.list_of_available_books();
while(true)
{
loading();
system("cls");
cout<<m1.get_details()<<endl;
cout<<"1. Borrow Book"<<endl;
cout<<"2. Return Book"<<endl;
cout<<"3. Show borrowed Books"<<endl;
cout<<"4. Exit"<<endl;
cout<<"Enter Choice: ";
cin>>choice;
if(choice=="1")
{
string isbn;
l.list_of_available_books();
cout<<"Select book by ISBN: ";
cin>>isbn;
Book *book=l.findbook(isbn);
m1.borrow_book(book);
}
else if(choice=="2")
{
string isbn;
m1.list_of_books();
cout<<"Select book by ISBN: ";
cin>>isbn;
Book *book=l.findbook(isbn);
m1.return_book(book);
}
else if(choice =="3")
{
m1.list_of_books();
char key=_getch(); // wait until any key is pressed
}
else
exit(0);