Issue the books to various members of library.
– Member-Membername, Age, Address
– Faculty (derived from member classs)- Department and integer type array for issuing books with upperlimit 10.
– Student (derived from member class)- Class, Rollno and integer type array for issuing books with upperlimit 4.
Daily Transaction (derived from Faculty and Student classes)- date of issue, date of return (calculated from date of issue as 15 days for students and 45 days for a faculty).
#include
#include
#include
#include
#include
class CDATE{
private:
int dd;
int mm;
int yy;
public:
struct date d;
CDATE(){
getdate(&d);
dd = d.da_day;
mm = d.da_mon;
yy = d.da_year;
}
CDATE(int d, int m, int y){
dd = d;
mm = m;
yy = y;
}
};
class CMember{
protected:
char m_name[20], m_add[30];
int m_age;
public:
CMember(){}
CMember(char *Mnam, char *Madd, int Mage){
strcpy(m_name, Mnam);
strcpy(m_add, Madd);
m_age = Mage;
}
};
class CFaculty : public virtual CMember{
protected:
char f_dept[20];
int f_bk_issue;
public:
CFaculty(){}
CFaculty(char *Fdept, int Fiss){
strcpy(f_dept, Fdept);
f_bk_issue = Fiss;
}
};
class CStudent : public virtual CMember{
protected:
char s_clas[10];
int s_roll, s_bk_issue;
public:
CStudent(){}
CStudent(char *Sclas, int Sroll, int Siss){
strcpy(s_clas, Sclas);
s_roll = Sroll;
s_bk_issue = Siss;
}
};
class CTrans: public CFaculty , public CStudent{
private:
CDATE dt;
int dayStu;
int dayFac;
char bk_name[20];
public:
CTrans(){
dayStu = 15;
dayFac = 45;
}
CTrans(char *Tnam, char *Tadd, int Tage, char *Tdept,
int Tiss, char *Tbk_nam, CDATE Tdoi)
: CMember(Tnam, Tadd, Tage), CFaculty(Tdept, Tiss){
strcpy(bk_name, Tbk_nam);
dt = Tdoi;
}
CTrans(char *Tnam, char *Tadd, int Tage, char *Tclas,
int Troll, int Tiss, char *Tbk_nam, CDATE Tdoi)
: CMember(Tnam, Tadd, Tage), CStudent(Tclas, Troll,
Tiss){
strcpy(bk_name, Tbk_nam);
dt = Tdoi;
}
void Fac_Show(){
cout<<"\n Faculty Details";
cout<<"\n Name: "< cout<<"\n Address: "< cout<<"\n Age: "< cout<<"\n Department: "< cout<<"\n Total Books to Issue: "< cout<<"\n Book name: "< }
void Stu_Show(){
cout<<"\n Student Details";
cout<<"\n Name: "< cout<<"\n Address: "< cout<<"\n Age: "< cout<<"\n Class: "< cout<<"\n Total Books to Issue: "< cout<<"\n Book name: "< }
};
void main(){
int ch;
char book_name[20];
CTrans ObjLib;
while(1){
clrscr();
cout<<"\n LIBRARY MANAGEMANT";
cout<<"\n ~~~~~~~~~~~~~~~~~~";
cout<<"\n 1 -> Issue Books to Faculty.";
cout<<"\n 2 -> Issue Books to Student.";
cout<<"\n 3 -> Show Details of Faculty.";
cout<<"\n 4 -> Show Details of Student.";
cout<<"\n 5 -> EXIT.";
cout<<"\n Enter your choice: ";
cin>>ch;
switch(ch){
case 1:
cout<<"\n Enter Book Name: ";
cin>>book_name;
CDATE dt1(5, 10, 2004);
CTrans Olib1("Manoj", "Dwarka", 23,
"Computer", 15, book_name, dt1);
break;
case 2:
cout<<"\n Enter Book Name: ";
cin>>book_name;
CDATE dt2(5, 10,2004);
CTrans Olib2("Nitin", "Dwarka", 24, "MCA",
214, 5, book_name, dt2);
break;
case 3:
ObjLib.Fac_Show();
break;
case 4:
ObjLib.Stu_Show();
break;
default:
exit(1);
} // end of switch.
getch();
} // end of while.
} // end of main.
Output:
LIBRARY MANAGEMANT: –
~~~~~~~~~~~~~~~
1 -> Issue Books to Faculty.
2 -> Issue Books to Student.
3 -> Show Details of Faculty.
4 -> Show Details of Student.
5 -> EXIT.
Enter your choice: 2
Name: Manoj
Address: Dwarka
Age: 23
Course: MCA
Enter Book Name: c plus plus
LIBRARY MANAGEMANT: –
~~~~~~~~~~~~~~~
1 -> Issue Books to Faculty.
2 -> Issue Books to Student.
3 -> Show Details of Faculty.
4 -> Show Details of Student.
5 -> EXIT.
Enter your choice: 4
Student Details: –
Name: Manoj
Address: Dwarka
Age: 23
Course: MCA
Total Books to Issue: 4
Book name: CPP
– Member-Membername, Age, Address
– Faculty (derived from member classs)- Department and integer type array for issuing books with upperlimit 10.
– Student (derived from member class)- Class, Rollno and integer type array for issuing books with upperlimit 4.
Daily Transaction (derived from Faculty and Student classes)- date of issue, date of return (calculated from date of issue as 15 days for students and 45 days for a faculty).
#include
#include
#include
#include
#include
class CDATE{
private:
int dd;
int mm;
int yy;
public:
struct date d;
CDATE(){
getdate(&d);
dd = d.da_day;
mm = d.da_mon;
yy = d.da_year;
}
CDATE(int d, int m, int y){
dd = d;
mm = m;
yy = y;
}
};
class CMember{
protected:
char m_name[20], m_add[30];
int m_age;
public:
CMember(){}
CMember(char *Mnam, char *Madd, int Mage){
strcpy(m_name, Mnam);
strcpy(m_add, Madd);
m_age = Mage;
}
};
class CFaculty : public virtual CMember{
protected:
char f_dept[20];
int f_bk_issue;
public:
CFaculty(){}
CFaculty(char *Fdept, int Fiss){
strcpy(f_dept, Fdept);
f_bk_issue = Fiss;
}
};
class CStudent : public virtual CMember{
protected:
char s_clas[10];
int s_roll, s_bk_issue;
public:
CStudent(){}
CStudent(char *Sclas, int Sroll, int Siss){
strcpy(s_clas, Sclas);
s_roll = Sroll;
s_bk_issue = Siss;
}
};
class CTrans: public CFaculty , public CStudent{
private:
CDATE dt;
int dayStu;
int dayFac;
char bk_name[20];
public:
CTrans(){
dayStu = 15;
dayFac = 45;
}
CTrans(char *Tnam, char *Tadd, int Tage, char *Tdept,
int Tiss, char *Tbk_nam, CDATE Tdoi)
: CMember(Tnam, Tadd, Tage), CFaculty(Tdept, Tiss){
strcpy(bk_name, Tbk_nam);
dt = Tdoi;
}
CTrans(char *Tnam, char *Tadd, int Tage, char *Tclas,
int Troll, int Tiss, char *Tbk_nam, CDATE Tdoi)
: CMember(Tnam, Tadd, Tage), CStudent(Tclas, Troll,
Tiss){
strcpy(bk_name, Tbk_nam);
dt = Tdoi;
}
void Fac_Show(){
cout<<"\n Faculty Details";
cout<<"\n Name: "<
void Stu_Show(){
cout<<"\n Student Details";
cout<<"\n Name: "<
};
void main(){
int ch;
char book_name[20];
CTrans ObjLib;
while(1){
clrscr();
cout<<"\n LIBRARY MANAGEMANT";
cout<<"\n ~~~~~~~~~~~~~~~~~~";
cout<<"\n 1 -> Issue Books to Faculty.";
cout<<"\n 2 -> Issue Books to Student.";
cout<<"\n 3 -> Show Details of Faculty.";
cout<<"\n 4 -> Show Details of Student.";
cout<<"\n 5 -> EXIT.";
cout<<"\n Enter your choice: ";
cin>>ch;
switch(ch){
case 1:
cout<<"\n Enter Book Name: ";
cin>>book_name;
CDATE dt1(5, 10, 2004);
CTrans Olib1("Manoj", "Dwarka", 23,
"Computer", 15, book_name, dt1);
break;
case 2:
cout<<"\n Enter Book Name: ";
cin>>book_name;
CDATE dt2(5, 10,2004);
CTrans Olib2("Nitin", "Dwarka", 24, "MCA",
214, 5, book_name, dt2);
break;
case 3:
ObjLib.Fac_Show();
break;
case 4:
ObjLib.Stu_Show();
break;
default:
exit(1);
} // end of switch.
getch();
} // end of while.
} // end of main.
Output:
LIBRARY MANAGEMANT: –
~~~~~~~~~~~~~~~
1 -> Issue Books to Faculty.
2 -> Issue Books to Student.
3 -> Show Details of Faculty.
4 -> Show Details of Student.
5 -> EXIT.
Enter your choice: 2
Name: Manoj
Address: Dwarka
Age: 23
Course: MCA
Enter Book Name: c plus plus
LIBRARY MANAGEMANT: –
~~~~~~~~~~~~~~~
1 -> Issue Books to Faculty.
2 -> Issue Books to Student.
3 -> Show Details of Faculty.
4 -> Show Details of Student.
5 -> EXIT.
Enter your choice: 4
Student Details: –
Name: Manoj
Address: Dwarka
Age: 23
Course: MCA
Total Books to Issue: 4
Book name: CPP
Comments
Post a Comment
share your thoughts ....