القائمة الرئيسية

الصفحات

تحميل مشروع نظام إدارة مكتبة مركزية باستخدام البرمجة الكائنية بلغة سي بلس بلس c++ مجانا -اليمن التقني

تابعنا ليصلك كل جديد

 مشروع إداة مكتبة مركزية بلغة البرمجة البرمجة الشيئية

هذا المشروع هو مشروع نهاية الترم لمادة البرمجة الهدفية الموجهة قم بتحميله مجانا لغرض الفائدة العلمية

من اجل الفائدة شاهد الفيديوا في النهاية من اجل معرفة عض الأمور المتقدمة في هذا المشروع 

قبل الشرح اليك مخطط UML  للمشروع


UML library management system مشروع ادارة مكتبة oop



في هذا المشروع تم انشاء 6 فئات او كلاسات كل كلاس يمثل كائن
مثلا عندنا أولا كلاس الكتاب وهو لم يستخدم ولكن تم انشاءه من اجل ان نورثه لكلاس الكتب العلمية وكلاس الكتب الترفيهية

الكلاس الأول هو كلاس الكتاب:class book

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
 class Book {‎
  protected:‎
    string title;‎
    bool available;‎
    int BookID;‎
    int volumes;‎
    int studentId;‎
  public:‎
    Book() {‎
        title = "unknown";‎
        BookID =-1;‎
        available = false;‎
        volumes = 0;‎
        studentId=-1;‎
    }‎

    Book(string Title, int Id, bool ava, int chapters = 1) {‎
        setBook(Title, Id, ava);‎
        volumes = chapters;‎
        studentId=-1;‎
    }‎

    void setBook(string Title, int Id, bool ava, int chapters = 1) {‎
        setTitle(Title);‎
        setBookID(Id);‎

    }‎

    void setTitle(string Title) {‎
        if (Title.size() > 0)‎
            this->title = Title;‎
        else
            cout << "\n you must input a Title";‎
    }‎

    void setBookID(int Id) {‎
		BookID = Id;‎

    }‎

    void setBookAvailability(bool ava,int std1=-1) {‎
        available = ava;‎
        studentId=std1;‎
    }‎

    string getTitle() {‎
        return title;‎
    }‎
    int getBookID() {‎
        return BookID;‎
    }‎

    bool &getAvailability() {‎
		if (studentId == -1)‎
			available = true;‎
        return available;‎
    }‎

    void print() {‎
        cout << setw(20) << "The Book Title : " << setw(30) << title << endl;‎
        cout << setw(20) << "The Book ID is : " << setw(15) << BookID << endl;‎
        cout << setw(20) << "It is consist of   " << volumes << " Volume\n";‎
        cout << setw(20) << "Is The Book Available?  ";‎
        if (available)‎
            cout << setw(10) << "Yes" << endl;‎
        else {‎
            cout << setw(10) << "No" << endl;‎
            cout<<setw(30)<<"\nBook Borrowed by Student ID : ‎‎"<<setw(15)<<studentId;‎
        }‎
    }‎


 ‎};‎

تم استخدام الوصف للمتغيرات باللعربية بدلا من اسمه الذي استخدم برمجيا


يحتوي هذا الكلاس على المتغيرات التالية
هذه المتغيرات هي بالجزء المحمي وذلك من اجل الوراثة بحيث اذا قمنا بتوريثها سيتم توريثها الى الجزء الخاص
اما اذا كانت هذه البيانات في الجزء الخاص فإنه لن يتم توريثها لان هذه قواعد الوراثة
  1. العنوان : يخزن هذا المتغير عنوان الكتاب ونوع بيانته string
  2.  حالة الكتاب : هذا المتغير يخزن هل الكتاب متوفر ام لا اذا كان الكتاب قد استلفه احد الطلاب فيكون غير متوفر ونوع بيانته منطقي bool
  3.  رقم الكتاب : هذا المتغير يخزن رقم الكتاب ولكل كتاب رقم خاص به لا يتكرر ونوع بيانته رقم int
  4.  أجزاء الكتاب : هذا المتغير يخزن كم عدد اجزء الكتاب دائما الكتب العلمية تاتي من عدة اجزء قد تكون الكتب الترفيهية تتكون من عدة أجزاء أيضا
  5.  رقم الطالب : هذا المتغير يخزن رقم الطالب الذي قام باستلاف الكتاب فاذا كان الكتاب متوفر فيكون قيمة هذا المتغير فارغ

في الجزء العام من الكلاس يوجد لدينا الدوال التي سوف تتعامل مع المتغيرات
أولا يوجد لدينا دالتين بناء او مشيد احداها افتراضيه لا تستقبل قيم والأخرى تستقبل قيم على عدد المتغيرات 

الكلاس الثاني هو كلاس الكتب العلمية :class educational

 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
 class Educational : public Book {‎
  private:‎
    string author[7];‎
    string topic;‎
    string major;‎
    int authorcount;‎

public:‎
    Educational() : author() {‎
        authorcount = 0;‎
        topic = "without topic";‎
        major = "unknown";‎
    }‎

    Educational(string Title, int Id, bool ava, string topc, string Major, string authors[], int ‎how_many_authors, int chapters = 1) : Book(Title, Id, ava,chapters) {‎
		authorcount = 0;‎
		setEductionalBook(topc, Major, authors, how_many_authors);‎
    }‎

    void setEductionalBook(string topc, string Major, string authors[], int ‎how_many_authors) {‎
        setAuthors(authors, how_many_authors);‎
        setTopicAndMajor(topc, Major);‎
    }‎

    void setAuthors(string authors[], int how_many_authors) {‎
        if (authorcount + how_many_authors > 7)‎
            cout << "\nthe authors are so much \n";‎
        else {‎
            if (how_many_authors < 0)‎
                cout << "\nA Book can not have no author it must has at least one ‎author\n ";‎
            else
                for (int i = 0; i < how_many_authors; i++) {‎
                    author[authorcount] = authors[i];‎
                    authorcount++;‎

                }‎
        }‎
    }‎

    void setTopicAndMajor(string topc, string Major) {‎
        topic = topc;‎
        major = Major;‎
    }‎

    string *getAuthors(int &numofauthors) {‎
        numofauthors = authorcount;‎
        return author;‎
    }‎

    string getMajor() const {‎
        return major;‎
    }‎

    string getTopic() const {‎
        return topic;‎
    }‎

    void printauthors() {‎
        if (authorcount < 1)‎
            cout << setw(20) << "\nthe author is unknown\n";‎
        else {‎
            for (int i = 0; i <= authorcount; i++) {‎
                cout << endl << i + 1 << "" << setw(30) << author[i];‎
            }‎

	   }‎
    }‎

    void print() {‎
        cout << setw(20) << "The Book Title : " << setw(30) << title << endl;‎
        cout << setw(20) << "The Book ID is : " << setw(15) << BookID << endl;‎
        cout << setw(20) << "It is consist of   " << volumes << " Volume\n";‎
        cout << setw(20) << "Is The Book Available?  ";‎
        if (available)‎
            cout << setw(10) << "Yes" << endl;‎
        else
            cout << setw(10) << "No" << endl;‎


    }‎

‎ };‎


هذا الكلاس يورث من الكلاس الأول
بالإضافة الى البيانات التالية التي يحتويها
أولا المتغيرات توجد المتغيرات في الجزء الخاص
  1. مصفوفة حجمها 7 لتخزين المؤلفين لان اغلب الكتب العلمية تؤلف من قبل اكثر من مؤلف ونوع البيانات سلسلة نصية
  2. الموضوع : هذا المتغير يخزن موضوع الكتاب ماهو الموضوع الذي يتحدث عنه هذا الكتاب
  3.  التخصص : هذا المتغير يخزن التخصص الذي ينتمي اليه الكتاب
  4.  وعداد المؤلفين : وذلك من اجل تخزين عدد المؤلفين لكل كتاب

ثانيا الدوال :

في الجزء العام يوجد الدوال الخاصة بهذا الكلاس والتي تتعامل مع المتغيرات الموجودة في الجزء الخاص

 

الكلاس الثالث : كلاس الكتب الترفيهية: class entertainment 

 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
lass Entertainment : public Book {‎
private:‎
    string publisher;‎
    string date;‎
    string author;‎
public:‎
    Entertainment() {‎
        publisher = "unknown";‎
        date = "0000";‎
        author = "unknown";‎

    }‎

    Entertainment(string Title, int Id, bool ava,string publish_by, string year, string writer,int chapters = ‎‎1) : Book(Title ,Id,ava,chapters){‎
        set(publish_by, year, writer);‎
    }‎

    void set(string publish_by, string year, string writer) {‎
        publisher = publish_by;‎
        date = year;‎
        author = writer;‎
    }‎

    void setPublisher(string publish_by) {‎
        publisher = publish_by;‎
    }‎

    void setDate(string year) {‎
        date = year;‎
    }‎

    void setAuthor(string writer) {‎
        author = writer;‎
    }‎

    string getPublisher() {‎
        return publisher;‎
    }‎

    string getDate() {‎
        return date;‎
    }‎

    string getAuthor() {‎
        return author;‎
    }‎

    void printinfo() {‎
        cout << setw(15) << "Published by " << setw(30) << publisher << endl;‎
        cout << setw(15) << "Written by " << setw(30) << author << endl;‎
        cout << setw(15) << "Published in " << setw(16) << date << endl;‎
        print();‎

    }‎

‎};‎


هذا الكلاس يورث كلاس الكتاب بالإضافة الى المتغيرات التي يحتويها هذا الكلاس وهي كالتالي
  1.  الناشر هذا المتغير يخزن اسم الناشر ويخزن سلسلة نصيه
  2.  التاريخ وهو تاريخ طباعة الكتاب ونوع بياناته عدد صحيح
  3.  المؤلف الكتب الترفيهية عادة ما تحتوي على مؤلف واحد فقط نادرا ما تجد كتاب ترفيهي تم كتابته بواسطة اكثر من شخص

ثانيا الدوال في هذا الكلاس هي دوال للتعامل مع المتغيرات الموجودة في الجزء الخاص من هذا الكلاس

الكلاس الرابع هو كلاس الموظفين:class staff

 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
class Staff {‎
 private:‎
    string password;‎
 protected:‎
    string name;‎
    int IDNumber;‎
    int contactNumber;‎

  public:‎
    Staff() {‎
        password = "0000";‎
        name = "Unknown";‎
        IDNumber = -1;‎
        contactNumber = -1;‎
    }‎

    Staff(string Name, int ID, int contact, string pass = "0000") {‎
		if (pass == "student")‎
			set(Name, ID, contact);‎
		else
		set(Name, ID, contact, password);‎
    }‎

    void set(string Name, int ID, int contact, string pass ) {‎
        name = Name;‎
        IDNumber = ID;‎
        contactNumber = contact;‎
        setPassword(pass);‎
    }‎
	void set(string Name, int ID, int contact) {‎
		name = Name;‎
		IDNumber = ID;‎
		contactNumber = contact;‎
	‎}‎

    void setPassword(string pass) {‎
		int sze = pass.length();‎
		if (sze >= 4)‎
			password = pass;‎
		else if (password == "-1")‎
			password = "0000";‎
		else if(sze<4)‎
            cout << "invalid password it must be 4 \"digits, charicters , or ‎numbers\" or more than 4" << endl;‎
    }‎

    string getPassword() {‎
        return password;‎
    }‎

    string getName() {‎
        return name;‎
    }‎

    int getID() {‎
        return IDNumber;‎
    }‎

    int getContactNum() {‎
        return contactNumber;‎
    }‎

    void print(int t=0) {‎
        string type = "staff";‎
        if(t==1)‎
            type="student";‎
        cout<<endl<<setw(7)<<left<<type<<setw(30)<<left<<"'s Name is ‎‎"<<setw(15)<<left<<name;‎
        cout<<endl<<setw(7)<<left<<type << setw(30) <<left<<"'s ID Number  is ‎‎"<<setw(15)<<left<<IDNumber;‎
        cout<<endl<<setw(7)<<left<<type << setw(30) <<left<<"'s Contact Number is ‎‎"<<setw(15)<<left<<contactNumber;‎


    }‎
‎};‎


في هذا الكلاس بيانات خاصه تم جعله اب لكلاس الطالب لان الطالب له صفات لاتتوفر في الموظف لذلك قمنا بتوريث كلاس الموظف الى كلاس الطالب
كلاس الموظف يحتوي على البيانات او المتغيرات التالية
 كلمة المرور : هذه الصفة خاصة بالموظف فقط ولا توجد في الطالب لذلك جعلها في الجزء الخاص حيث نعلم انه لايمكن للكلاس الابن ان يرث ما داخل الجزء الخاص
  1.  الاسم : هذا المتغير في الجزء المحمي وذلك من اجل القدرة على توريثه وهو يخزن الاسم
  2.  رقم المعرف : هذا المتغير يخزن رقم خاص لكل موظف حيث لا يمكن ان يكون لأكثر من موظف نفس الرقم
  3.  رقم التواصل : هذا المتغير يخزن الرقم الذي سوف يتم التواصل به مع الموظف

الكلاس الخامس : كلاس الطالب:class student

 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
class Student:public Staff{‎
 private:‎
    string major;‎
    int level;‎
	string kind;‎

  public:‎
    Student(){‎
        major= "unkonwn";‎
        level=0;‎
		kind = "student";‎
    }‎
    Student(string Name, int ID, int contact, string Major,int lvl):Staff(Name , ID ‎‎, contact , "student"){‎

        setStudent(Major , lvl);‎
    }‎
    void setStudent(string Major , int lvl){‎
        major=Major;‎
        level=lvl;‎
    }‎
    string getMajor()const{‎
        return major;‎
    }‎

    int getLevel()const{‎
        return level;‎
    }‎
    void print(){‎
        Staff::print(1);‎
        cout<<endl<<setw(7)<<left<<"Student"<<setw(30)<<left<<"'s Major is ‎‎"<<setw(15)<<left<<major;‎
        cout<<endl<<setw(7)<<left<<"Student" << setw(30) << left <<"'s Level is ‎‎"<<setw(15)<<left<<level;‎

    }‎



‎};‎


هذا الكلاس يرث من كلاس الموظف ولكن بيانات أخرى إضافية من اجل سهولة الوصول الى الطالب وهي كالتالي
  1.  التخصص : حيث يجب ان يخزن لكل طالب ماهو تخصصه
  2.  المستوى الدراسي : يجب ان يخصص مستوى كل طالب بجوار تخصصه
ثانيا الدوال في هذا الكلاس البعض منها دوال موروثه من كلاس الموظف والبعض منها دوال معرفة خاصة بهذا الكلاس

الكلاس السادس في المشروع: كلاس ادارة المكتبة المركزية : library_management_system

  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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347  
348
349
350
351
class libraryManagement{‎
 private:‎
    Staff staffs[10];‎
    int staffCounter;‎
    Entertainment entertainments[10];‎
    int entertainmentCounter;‎
    Educational educationals[10];‎
    int educationalCounter;‎
    int borrowedBookCounter;‎
    Student students[10];‎
    int studentCounter;‎
 public:‎
    libraryManagement(){‎
        staffCounter = entertainmentCounter = educationalCounter= ‎borrowedBookCounter =studentCounter=0;‎
    }‎
	void addStudent(string Name, int ID, int contact, string Major, int lvl) {‎
		Student std(Name, ID, contact, Major, lvl);‎
		students[studentCounter++] = std;‎
	‎}‎

    void addStaff(string Name, int ID, int contact, string pass = "0000"){‎
        staffs[staffCounter++] = Staff( Name, ID, contact, pass);‎
    }‎

    void addEntertainment(string Title, int Id, bool ava,string publish_by, string ‎year, string writer,int chapters=1){‎
		Entertainment entbook(Title, Id, ava, publish_by, year, writer, ‎chapters);‎				
		entertainments[entertainmentCounter++] = entbook;‎
    }‎
    void addEdecational(string Title, int Id, bool ava, string topic, string Major, ‎string authors[], int how_many_authors,int chapters=1){‎
		Educational edubook(Title, Id, ava, topic, Major, authors, ‎how_many_authors, chapters);‎
		educationals[educationalCounter++] = edubook;‎
	‎}‎
    void lendBook(Educational b , int studentId){‎
		int id;‎
		Educational educationalBook;‎
		Entertainment entertainmentbook;‎
		id = b.getBookID();‎
		if (checkBookID(id)) {‎
			if (getBookByID(id, educationalBook, entertainmentbook) == ‎‎"edu")‎
				if (educationalBook.getAvailability()) {‎
					educationalBook.setBookAvailability(false, ‎studentId);‎
					borrowedBookCounter++;‎
				‎}‎
				else if (getBookByID(id, educationalBook, ‎entertainmentbook) == "ent")‎
					if (entertainmentbook.getAvailability()) {‎
						entertainmentbook.setBookAvailability(false, studentId);‎
						borrowedBookCounter++;‎
					‎}‎
				else {‎
					cout << "the book is not available now" << ‎endl;‎
				‎}‎
		‎}‎
		else
			cout << "\nthe Book is not found make sure of the ‎spelling\n";‎
    }‎
	//string getBookbyid(int id) {‎

	//}‎
	void lendBook(Entertainment b, int studentId) {‎
		if (b.getAvailability()) {‎
			b.setBookAvailability(false, studentId);‎
			borrowedBookCounter++;‎
		‎}‎
		else {‎
			cout << "the book is not available now" << endl;‎
		‎}‎
	‎}‎
    void returnBook(Educational b){‎
     if(b.getAvailability())‎
         cout<<"the book is not borrowed yet"<<endl;‎
     else{‎
         b.setBookAvailability(true);‎
         borrowedBookCounter--;‎
     }‎
    }‎
void returnBook(Entertainment b) {‎
		if (b.getAvailability())‎
			cout << "the book is not borrowed yet" << endl;‎
		else {‎
			b.setBookAvailability(true);‎
			borrowedBookCounter--;‎
		‎}‎
	‎}‎
    void deleteBook(int Id){‎
        int j=0;‎
        for(int i=0 ; i<entertainmentCounter;i++)‎
            if(entertainments[i].getBookID()==Id)‎
                for(j=i ;j<entertainmentCounter-1;j++)‎
                    entertainments[j]=entertainments[j+1];‎
		if(j==0)‎
		 for(int i=0 ; i<educationalCounter;i++)‎
				if(educationals[i].getBookID()==Id)‎
					for(int j=i ;j<educationalCounter-1;j++)‎
						educationals[j]=educationals[j+1];‎
    }‎

	string getBookByID(int id, Educational &edu, Entertainment &ent) {‎
		for (int i = 0; i < entertainmentCounter; i++)‎
			if (id == entertainments[i].getBookID()){‎
		    	ent = entertainments[i];‎
	        	return" ent";}‎
	
		for (int i = 0; i < educationalCounter; i++)‎
			if (id == educationals[i].getBookID())‎
			‎{‎
				edu = educationals[i];‎
				return "edu";‎
			‎}‎
		return "not found";‎
	‎}‎
    void sort(string by,string sort="asc"){‎
		if (sort == "asc") {‎
			if (by == "name") {‎
				for (int j = 0; j < educationalCounter; j++)‎
					for (int i = j; i < educationalCounter; i++) {‎
						if (educationals[j].getTitle() > ‎educationals[i].getTitle())‎
						‎{‎
							Educational temp = ‎educationals[i];‎
							educationals[i] = ‎educationals[j];‎
							educationals[j] = temp;‎

						‎}‎
					‎}‎
			‎}‎

			else if (by == "id") {‎
				for (int j = 0; j < educationalCounter; j++)‎
					for (int i = j; i < educationalCounter; i++) {‎
						if (educationals[j].getBookID() > ‎educationals[i].getBookID())‎
						‎{‎
							Educational temp = ‎educationals[i];‎
							educationals[i] = ‎educationals[j];‎
							educationals[j] = temp;‎

						‎}‎
					‎}‎
			‎}‎
		‎}‎
			else {‎
				if (by == "name") {‎
					for (int j = 0; j < educationalCounter; j++)‎
						for (int i = j; i < educationalCounter; ‎i++) {‎
							if (educationals[j].getTitle() < ‎educationals[i].getTitle())‎
							‎{‎
								Educational temp = ‎educationals[i];‎
								educationals[i] = ‎educationals[j];‎
								educationals[j] = temp;‎

							‎}‎
						‎}‎
				‎}‎
				else if (by == "id") {‎
					for (int j = 0; j < educationalCounter; j++)‎
						for (int i = j; i < educationalCounter; ‎i++) {‎
							if (educationals[j].getBookID() ‎‎< educationals[i].getBookID())‎
							‎{‎
								Educational temp = ‎educationals[i];‎
								educationals[i] = ‎educationals[j];‎
								educationals[j] = temp;‎

							‎}‎
						‎}‎
				‎}‎
			‎}‎
		‎}‎
	void printEdicationalBooks() {‎
		cout << endl;‎
		line('-', 50);‎
		for (int i = 0; i < educationalCounter; i++) {‎
			educationals[i].print();‎
			cout << endl;‎
			line('-', 50);‎
		‎}‎
	‎}‎
	void printEntertainmentBooks() {‎
		cout << endl;‎
		line('-', 50);‎
		for (int i = 0; i < entertainmentCounter; i++) {‎
			entertainments[i].print();‎
			cout << endl;‎
			line('-', 50);‎
		‎}‎
‎}‎
Educational getEducational_by_ID(int id) {‎
		for (int i = 0; i < educationalCounter; i++) 
			if (id == educationals[i].getBookID())‎
				return educationals[i];‎
		cout << "\n this ID did not match any of the books in Educational ‎section";‎
			return Educational();‎
	‎}‎
	Entertainment getEntertainment_by_ID(int id) {‎
			for (int i = 0; i < entertainmentCounter; i++) 
				if (id == entertainments[i].getBookID())‎
					return entertainments[i];‎
			cout << "\n this ID did not match any of the books in ‎Entertainment section";‎
				return Entertainment();‎
		‎}‎
	bool checkBookID(int id) {‎
		for (int i = 0; i < educationalCounter; i++) {‎
			if (educationals[i].getBookID() == id)‎
				return true;‎
		‎}‎
		for (int i = 0; i < entertainmentCounter; i++) {‎
			if (entertainments[i].getBookID() == id)‎
				return true;‎
		‎}‎
		cout << "\n There is no Book has this ID Make sure you wrote it ‎correctly";‎
		return false;‎
	‎}‎
	bool checkStaff(int id, string pass) {‎
		Staff chk;‎
		for (int i = 0; i < staffCounter; i++) {‎
			if (staffs[i].getID() == id)‎
			‎{‎
				chk = staffs[i];‎
				break;‎
			‎}‎
		‎}‎
		if (chk.getPassword() == pass)‎
			return true;‎
	//‎	cout << "\n wrong password";‎
		return false;‎
	‎}‎

	bool checkStudentID(int id) {‎
		for (int i = 0; i < studentCounter; i++)‎
			if (students[i].getID())‎
				return true;‎
		cout << "\n this student is not found";‎
		return false;‎
	‎}‎
	bool checkAvailablity(Educational book) {‎
		if (book.getAvailability())‎
			return true;‎
		cout << "\n the book is not available";‎
		return false;‎
	‎}‎
	bool checkAvailablity(Entertainment book) {‎
		return book.getAvailability();‎
	‎}‎
	string checkMembership(int id, Student &stud, Staff &staf) {‎
		for (int i = 0; i < studentCounter; i++) {‎
			if (id == students[i].getID())‎
				return "student";‎
		‎}‎
		for (int i = 0; i < staffCounter; i++) {‎
			if (id == staffs[i].getID())‎
				return "staff";‎
		‎}‎
		cout << "\n this person  is not a Member";‎
		return "invalid ID";‎
	‎}‎
	bool checkStaff(int id) {‎
		for (int i = 0; i < staffCounter; i++)‎
			if (staffs[i].getID() == id)‎
				return true;‎
		cout << "\n this staff is not found";‎
			return false;‎
		
	‎}‎
	int getBookIDbyName(string name) {‎
		for (int i = 0; i <entertainmentCounter ; i++){‎
			if (name == entertainments[i].getTitle())‎
				return entertainments[i].getBookID();‎
		‎}‎
		for (int i = 0; i <educationalCounter; i++) {‎
			if (name == educationals[i].getTitle())‎
				return educationals[i].getBookID();‎
		‎}‎
		cout << "\nBook is not found";‎
		return -1;‎
	‎}‎
	int getStudentID_By_Name(string name) {‎
		for (int i = 0; i < studentCounter; i++)‎
			if (students[i].getName() == name)‎
				return students[i].getID();‎
		cout << "\n This student name is not found in the record ";‎
		return -1;‎
	‎}‎
	int getStaffID_By_Name(string name) {‎
		for (int i = 0; i < staffCounter; i++)‎
			if (staffs[i].getName() == name)‎
				return staffs[i].getID();‎
		cout << "\n This staff name is not found in the record ";‎
		return -1;‎
	‎}‎
	void deleteStudent(int Id) {‎
		if (!checkStudentID(Id))‎
			cout << "\n";‎
		for (int i = 0; i<studentCounter; i++)‎
			if (students[i].getID() == Id)‎
				for (int j = i; j<=studentCounter - 1; j++)‎
					students[j] = students[j + 1];‎
		studentCounter--;‎
		if (studentCounter == 0)‎
			cout << "there is no student in the record";‎
	‎}‎
	void deleteStudent(string name) {‎
		if (getStudentID_By_Name(name) == -1)‎
			cout << "\n There is no student with this name make sure of ‎the spelling ";‎
		for (int i = 0; i<studentCounter; i++)‎
			if (students[i].getName() == name)‎
				for (int j = i; j<studentCounter - 1; j++)‎
					students[j] = students[j + 1];‎
	‎}‎

	void deleteStaff(string name) {‎
		bool found = false;‎
			cout << "\n There is no staff with this name make sure of the ‎spelling ";‎
		for (int i = 0; i<staffCounter; i++)‎
			if (staffs[i].getName() == name) {‎
				found = true;‎
				for (int j = i; j < staffCounter - 1; j++)‎
					staffs[j] = staffs[j + 1];‎
			‎}‎
		if (!found)‎
			cout << "\n this staff is not found make sure you wrote the ‎right ID ";‎
	‎}‎
	void deleteStaff(int id) {‎
		bool found = false;‎
		cout << "\n There is no staff with this name make sure of the ‎spelling ";‎
		for (int i = 0; i<staffCounter; i++)‎
			if (staffs[i].getID() == id) {‎
				found = true;‎
				for (int j = i; j < staffCounter - 1; j++)‎
					staffs[j] = staffs[j + 1];‎
			‎}‎
		if (!found)‎
			cout << "\n this staff is not found make sure you wrote the ‎right ID ";‎
	‎}‎
	void printStudent() {‎
		cout << endl;‎
		line('-', 50);‎
		for (int i = 0; i < studentCounter; i++) {‎
			students[i].print();‎
			cout << endl;‎
			line('-', 50);‎
		‎}‎
	‎}‎
	void printStudent(int id) {‎
		cout << endl;‎
		line('-', 50);‎
		for (int i = 0; i < studentCounter; i++) {‎
			if (students[i].getID() == id)‎
				students[i].print();‎
		‎}cout << endl;‎
		line('-', 50);‎
	‎}‎
	

‎};‎

هذا الكلاس لايرث من أي كلاس اخر ولكن له القدرة على الوصول الى ل الكلاسات حيث تم تعريف كيانات من كل الفئات الأخرى حيث سيكون التعامل كاملا مع هذا الكلاس
تم تعريف مصفوفة من الكيانات المصفوفة بحجم 10 لكل كيان
يوجد دوال لا تنتمي لاي كلاس وهي اجل الاستدعاء وتنفيذ الأوامر التي يعطيها مستخدم النظام لهذا النظام

لتحميل المشروع كامل على شكل ملف مضغوط قم بتحميله من الزر في الاسفل

*ملاحظة  المشروع مبني على فيجول ستوديو 2015

ايضا اذا قمت بتنفيذ المشروع بدون تعديل تحتاج الى ادخال اسم المستخدم وكلمة المرور الموجودين في الدالة الرئيسية 

اسم المستخدم almonther

كلمة المرور ali888

تحميل file_download


اذا كان لديك اي ملاحظات حول مشروع إدراة مكتبة مركزية باستخدام مفاهيم البرمجة الشيئية بلغة سي بلس بلس
لاتسى ان تعلمنا عن ذلك بالتعليقات

تعليقات

تعليق واحد
إرسال تعليق
  1. لوسمحت نريد صورة المخطط بشكل واضح الصورة الموجودة في الأعلى غير واضحه

    ردحذف

إرسال تعليق

البحث في هذه المدونة الإلكترونية

جدول المحتويات