-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibrary.cpp
118 lines (117 loc) · 1.88 KB
/
library.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#include<iostream>
using namespace std;
class book
{
public:
char title[15],author[15],publisher[15];
int price;
void getdata();
};
class bookissue:public book
{
public:
int book_issue_days;
};
class bookreturn:public book
{
public:
int book_return_days;
};
class bookfine:public book,public bookissue,public bookreturn
{
public:
int k;
bookfine()
{
k=0;
}
int fines;
void fine();
};
void bookfine::fine()
{
int fine;
cout<<"enter the days of eturning the book";
cin>>book_return_days;
if(book_issue_days>book_return_days)
{
cout<<"book returned";
}
else
{
if(book_return_days<=7)
{
cout<<"\nyour book is late\nyou have to pay fine of amount: "<<book_return_days;
k--;
}
else
{
if(book_return_days>7&&book_return_days<=15)
{
cout<<"\nyour book is late\nyou have to pay fine of amount: "<<5*book_return_days;
k--;
}
else
{
if(book_return_days>15&&book_return_days<=30)
{
cout<<"\nyour book is late\nyou have to pay fine of amount: "<<10*book_return_days;
k--;
}
else
{
cout<<"\nyour book is late\nyou have to pay fine of amount equal to the book: "<<price;
k--;
}
}
}
}
}
void bookfine::getdata()
{
if(k<1)
{
cout<<"\nnew book entry:\nenter the title of the book";
gets(title);
cout<<"enter the name of author";
gets(author);
cout<<"enter the name of publisher";
gets(publisher);
cout<<"enter the book issue days";
gets(book_issue_days);
cout<<"enter the price of the book";
cin>>price;
cout<<"book issued--\n";
k++;
}
else
{
cout<<"\nyou can issue only one book at a time";
}
}
int main()
{
bookfine b;
int ch=0;
while(ch<=2)
{
cout<<"enter 1 for book issue\nenter 2 for return book/n3 for exit";
cin>>ch;
switch(ch)
{
case 1:
{
b.getdata();
}
case 2:
{
b.fine();
}
case 3:
{
break;
}
};
};
return 0;
}