-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hostel_Management_System.txt
735 lines (564 loc) · 19.4 KB
/
Hostel_Management_System.txt
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
Hostel Management System
IBonus.java
package HostelManagementSystem;
public interface IBonus {
void get_EidAlFitr_Bonus();
void get_EidAlAdha_Bonus();
}
IDiscount.java
package HostelManagementSystem;
public interface IDiscount {
void getDiscount();
}
Admin.java
package Admin;
public abstract class Admin {
public String name, adminId, age, performance, shift;
public double salary;
public void setinformation(String N, String I, String A, String P, String S) {
name = N;
adminId = I;
age = A;
performance = P;
shift = S;
}
public void printInformation() {
System.out.println("Name = " + name);
System.out.println("Admin Id = " + adminId);
System.out.println("Age = " + age);
System.out.println("Performance = " + performance);
System.out.println("Shift = " + shift);
}
public void getHealthInsurance()//Override without Interface
{
System.out.println("Health Insurance = " + salary * 0.05);
}
public abstract void MonitorActivitis();
}
JuniorAdmin.java
package Admin;
import HostelManagementSystem.IBonus;
public class JuniorAdmin extends Admin implements IBonus {
public String numberOfJob;
public JuniorAdmin(String NJ, double S) {
System.out.println("");
System.out.println("*****Junior Admin*****");
numberOfJob = NJ;
salary = S;
}
@Override //Override without Interface
public void getHealthInsurance() {
System.out.println("Health Insurance= " + (salary * 0.035));
}
public void job_number() {
System.out.println("Number of Job= " + numberOfJob);
}
public void printJuniorAdminSalary() {
System.out.println("Salary = " + salary);
}
@Override
public void get_EidAlFitr_Bonus() {
System.out.println("Bonus of Eid Al Fitr= " + (salary * 0.075));
}
@Override
public void get_EidAlAdha_Bonus() {
System.out.println("Bonus of Eid Al Adha= " + (salary * 0.05));
}
@Override
public void MonitorActivitis() {
System.out.println("Junior Admin monitors activities on website development");
}
}
SeniorAdmin.java
package Admin;
import HostelManagementSystem.IBonus;
public class SeniorAdmin extends Admin implements IBonus {
public String timeOfExprince;
public SeniorAdmin(String TE, double S) {
System.out.println("");
System.out.println("*****Senior Admin*****");
timeOfExprince = TE;
salary = S;
}
public void printSeniorAdminEx() {
System.out.println("Exprince = " + timeOfExprince);
}
public void printSeniorAdminSalary() {
System.out.println("Salary = " + salary);
}
@Override
public void get_EidAlFitr_Bonus() {
System.out.println("Bonus of Eid Al Fitr= " + (salary * 0.1));
}
@Override
public void get_EidAlAdha_Bonus() {
System.out.println("Bonus of Eid Al Adha= " + (salary * 0.075));
}
@Override
public void MonitorActivitis() {
System.out.println("Senior Admin monitors activities on Hostel Management System development");
}
}
Employee.java
package Employee;
public class Employee {
public String eId, Name, Age, performance;
public double salary;
public void setInformation(String I, String N, String A, String P, double S) {
eId = I;
Name = N;
Age = A;
performance = P;
salary = S;
}
public void printInfo() {
System.out.println("ID = " + eId);
System.out.println("Name = " + Name);
System.out.println("Age = " + Age);
System.out.println("Performance = " + performance);
System.out.println("Salary= " + salary);
}
public void SalaryExtandPerYear() //Override without Interface
{
System.out.println("All Empolyee has 10% Salary Extand Per Year");
}
}
Manager.java
package Employee;
import HostelManagementSystem.IBonus;
public class Manager extends Employee implements IBonus {
private String Status;
public Manager() {
System.out.println("*****Manager*****");
}
public void checkingDocoment(String S) {
Status = S;
switch (Status) {
case "Done":
System.out.println("Docoment is Done");
break;
case "ok":
System.out.println("Docoment is ok");
break;
default:
System.out.println("Docoment Is not complite");
break;
}
}
@Override
public void get_EidAlFitr_Bonus() {
System.out.println("Bonus of Eid Al Fitr= " + (salary * 0.75));
}
@Override
public void get_EidAlAdha_Bonus() {
System.out.println("Bonus of Eid Al Fitr= " + (salary * 0.50));
}
@Override
public void SalaryExtandPerYear()//Override without Interface
{
System.out.println("Only Manager has 15% Salary Extand Per Year");
}
}
Supervisor.java
package Employee;
import HostelManagementSystem.IBonus;
public class Supervisor extends Employee implements IBonus {
private String status;
public String workhour;
public Supervisor(String Wh) {
System.out.println("");
System.out.println("*****Supervisor*****");
workhour = Wh;
}
public void worktimeSupervisor() {
System.out.println("Working Time= " + workhour + " Hours");
}
public void CheckStudentDetails(String S) {
status = S;
switch (status) {
case "Fine":
System.out.println("All Students are Fine");
break;
case "Ok":
System.out.println("All Students are Ok");
break;
default:
System.out.println("Invalid Input");
break;
}
}
@Override
public void get_EidAlFitr_Bonus() {
System.out.println("Bonus of Eid Al Fitr= " + (salary * 0.40));
}
@Override
public void get_EidAlAdha_Bonus() {
System.out.println("Bonus of Eid Al Fitr= " + (salary * 0.35));
}
}
Food.java
package Food;
public class Food {
private String food_Item, category, sell, orderBy;
public void setFoodInfo(String fI, String C, String S, String O) {
food_Item = fI;
category = C;
sell = S;
orderBy = O;
}
public void printFoodInfo() {
System.out.println("");
System.out.println("********Food Details********");
System.out.println("Number Of Food Item= " + food_Item);
System.out.println("Category= " + category);
System.out.println("Sell On= " + sell);
System.out.println("Order By= " + orderBy);
}
}
Non_Veg_Food.java
package Food;
public class Non_Veg_Food extends Food {
public double melnonvegfood;
public void Non_VagFoodManu() {
System.out.println("");
System.out.println("*****Veg Food Manu*****");
System.out.println("Item:\n1.Chicken Biryani \t2.Chicken Nihari \t3. Chicken Manchorian \t4.Paraha \t5.Allu Gohi \t6.Roti\t7.Mutton Korma");
}
public void CostForNonVagFood(double me) {
melnonvegfood = me;
}
public void CostForNonVagFood()//overloaded methods
{
System.out.println("Cost of " + melnonvegfood + " BDT per mel Non Veg Food");
}
}
Veg_Food.java
package Food;
public class Veg_Food extends Food {
public double melvegfood;
public void VagFoodManu() {
System.out.println("");
System.out.println("*****Non-Veg Food Manu*****");
System.out.println("Item:\n1.Tea \t2.Rice \t3. Oats \t4.Paraha \t5.Allu Gohi \t6.Roti \t7. Carrots");
}
public void CostForVagFood(double me) {
melvegfood = me;
}
public void CostForVagFood()//overloaded methods
{
System.out.println("Cost of " + melvegfood + " BDT per mel Veg Food");
}
}
Room.java
package Room;
public class Room {
private String roomSize, numOfWindow;
public String roomNumber;
public double rentPDay, rentPMonth;
public void setRoomInfo(String RN, String RS, String NW) {
roomNumber = RN;
roomSize = RS;
numOfWindow = NW;
}
public void rentPerDay(double RD) {
rentPDay = RD;
}
public void rentPerMonth(double RM) {
rentPMonth = RM;
}
public void printRoomInfo() {
System.out.println("Room Number = " + roomNumber);
System.out.println("Room Size = " + roomSize);
System.out.println("Number of Window = " + numOfWindow);
System.out.println("Rent Per Month= " + rentPMonth);
System.out.println("Rent Per Day = " + rentPDay);
}
}
SingleBedRoom.java
package Room;
public class SingleBedRoom extends Room {
private String studentId;
public void SingleBedRoom() {
System.out.println("");
System.out.println("*****Single Bed Room*****");
}
public void StudentId(String RM, String ID) {
roomNumber = RM;
studentId = ID;
}
public void printSID() {
System.out.println("" + roomNumber + " is Allowed Student Id = " + studentId);
}
}
DoubleBedRoom.java
package Room;
public class DoubleBedRoom extends Room {
public int numberOfBed;
public String studentId1, studentId2;
public void DoubleBedRoom() {
System.out.println("");
System.out.println("*****Double Bed Room*****");
}
public void info(int NB)
{
numberOfBed = NB;
}
public void info() {
System.out.println("Number of Bed= " + numberOfBed);
}
public void StudentId(String ID, String Id, String RM) {
studentId1 = ID;
studentId2 = Id;
roomNumber = RM;
}
public void printSID() {
System.out.println("" + roomNumber + " is Allowed Student Id = " + studentId1 + "&" + studentId2);
}
}
Student.java
package Student;
public class Student {
public String name, sId, age, cgpa;
public void setInformation(String N, String I, String A, String CG) {
name = N;
sId = I;
age = A;
cgpa = CG;
}
public void printinformation() {
System.out.println("Student's Name = " + name);
System.out.println("Id = " + sId);
System.out.println("Age = " + age);
System.out.println("CGPA = " + cgpa);
}
}
PermanentStudent.java
package Student;
import HostelManagementSystem.IDiscount;
public class PermanentStudent extends Student implements IDiscount {
public String behave;
private double rentPM, rentPD, numberOfMal, rent, foodcost;
public double totalcost;
private int nBed;
public PermanentStudent(String b, double m) {
System.out.println("");
System.out.println("*****Permanent Student*****");
behave = b;
}
public void cost_of_PermanentStudent(int i, double k, int NB) {
if (i == 1) {
rentPM = k;
System.out.println("" + name + " is Single bed Room student");
System.out.println("Room Rent= " + rentPM);
rent = rentPM;
} else if (i == 2) {
nBed = NB;
rentPD = k;
System.out.println("" + name + " is Double bed Room student");
System.out.println("Room Rent= " + rentPD / nBed);
rent = rentPD / nBed;
}
}
public void cost_of_PermanentStudent(int i, double m, double f)//overloaded methods
{
if (i == 1) {
numberOfMal = m;
double melnonvegfood = f;
System.out.println("And he is a Non-Vegetarian");
numberOfMal = m;
foodcost = numberOfMal * melnonvegfood;
System.out.println("Food Cost= " + foodcost);
} else if (i == 2) {
numberOfMal = m;
double melvegfood = f;
System.out.println("And he is a Vegetarian");
numberOfMal = m;
foodcost = numberOfMal * melvegfood;
System.out.println("Food Cost= " + foodcost);
}
}
public void costCalculation() {
totalcost = rent + foodcost;
}
public void printcost(double i)//overloaded methods
{
totalcost = i;
System.out.println("Total cost= " + (totalcost));
}
@Override
public void getDiscount() {
System.out.println("Discount= " + (totalcost * 0.1));
}
public void printcost() {
System.out.println("Total cost after discount= " + (totalcost * 0.9));
}
}
TemporarilyStudent.java
package Student;
import HostelManagementSystem.IDiscount;
public class TemporarilyStudent extends Student implements IDiscount {
private double rentPM, rentPD, rent, foodcost;
public double totalcost, numberOfMal, totalday;
private int nBed;
public TemporarilyStudent(double TD, double m) {
System.out.println("");
System.out.println("*****Temporarily Student*****");
totalday = TD;
numberOfMal = m;
}
public void cost_of_TemporarilyStudent(int i, double k, int NB) {
i = i;
if (i == 1) {
rentPD = k;
System.out.println("" + name + " is Single bed Room student");
rent = rentPD * totalday;
System.out.println("Room Rent= " + rentPM);
} else if (i == 2) {
nBed = NB;
rentPD = k;
System.out.println("" + name + " is Double bed Room student");
rent = rentPD * totalday;
System.out.println("Room Rent= " + rent / nBed);
rent = (rentPD * totalday) / nBed;
}
}
public void cost_of_TemporarilyStudent(int i, double f)//overloaded methods
{
if (i == 1) {
double melnonvegfood = f;
System.out.println("And he is a Non-Vegetarian");
foodcost = numberOfMal * melnonvegfood;
System.out.println("Food Cost= " + foodcost);
} else if (i == 2) {
double melvegfood = f;
System.out.println("And he is a Vegetarian");
foodcost = numberOfMal * melvegfood;
System.out.println("Food Cost= " + foodcost);
}
}
public void costCalculation() {
totalcost = rent + foodcost;
}
public void printcost(double i)//overloaded methods
{
totalcost = i;
System.out.println("Total cost= " + (totalcost));
}
@Override
public void getDiscount() {
System.out.println("Discount = " + (totalcost * 0.05));
}
public void printcost() {
System.out.println("Total cost After Discount= " + (totalcost * 0.95));
}
}
Main.java
package HostelManagementSystem;
import Student.PermanentStudent;
import Student.TemporarilyStudent;
import Food.Non_Veg_Food;
import Food.Veg_Food;
import Food.Food;
import Room.SingleBedRoom;
import Room.DoubleBedRoom;
import Admin.SeniorAdmin;
import Admin.JuniorAdmin;
import Employee.Supervisor;
import Employee.Manager;
public class Main {
public static void main(String[] args) {
System.out.println("**************Hostel Management System **************");
SingleBedRoom SR1 = new SingleBedRoom();
SR1.rentPerDay(350);
SR1.rentPerMonth(5000);
Non_Veg_Food NV1 = new Non_Veg_Food();
NV1.CostForNonVagFood(80);
DoubleBedRoom DB1 = new DoubleBedRoom();
DB1.info(2);
DB1.rentPerDay(500);
DB1.rentPerMonth(9000);
Veg_Food V1 = new Veg_Food();
V1.CostForVagFood(45);
System.out.println("\n*******Employee Details********");
Manager ali = new Manager();
ali.setInformation("M101", "Ali Ahamed", "35 Years", "Excellent", 100000);
ali.printInfo();
ali.checkingDocoment("Done");
ali.get_EidAlFitr_Bonus();
ali.get_EidAlAdha_Bonus();
ali.SalaryExtandPerYear();
Supervisor S1 = new Supervisor("10");
S1.setInformation("SUP101", "AR Khan", "32 Year", "Ok", 50000);
S1.printInfo();
S1.SalaryExtandPerYear();
S1.CheckStudentDetails("Ok");
S1.get_EidAlFitr_Bonus();
S1.get_EidAlAdha_Bonus();
S1.worktimeSupervisor();
SeniorAdmin SA1 = new SeniorAdmin("5 Years", 75000);
SA1.setinformation("MD. Asraf Khan", "AD101", "27 Years", "Very Good", "Day");
SA1.printInformation();
SA1.printSeniorAdminEx();
SA1.get_EidAlFitr_Bonus();
SA1.get_EidAlAdha_Bonus();
SA1.getHealthInsurance();
SA1.MonitorActivitis();
SA1.printSeniorAdminSalary();
JuniorAdmin JA1 = new JuniorAdmin("1st Job", 30000);
JA1.setinformation("Ali Ahamud", "AD102", "22 Years", "Good", "Night");
JA1.printInformation();
JA1.job_number();
JA1.get_EidAlFitr_Bonus();
JA1.get_EidAlAdha_Bonus();
JA1.getHealthInsurance();
JA1.MonitorActivitis();
JA1.printJuniorAdminSalary();
Food F = new Food();
F.setFoodInfo("2", " Veg Food & Non-Veg Food", "Canteen", "Student's");
F.printFoodInfo();
NV1.Non_VagFoodManu();
NV1.CostForNonVagFood();
V1.VagFoodManu();
V1.CostForVagFood();
System.out.println("\n**********Student Details**********");
PermanentStudent PS1 = new PermanentStudent("Good", 80);
PS1.setInformation("Joy Khan", "S101", "19", "3.80");
PS1.printinformation();
PS1.cost_of_PermanentStudent(1, SR1.rentPMonth, 1);
PS1.cost_of_PermanentStudent(1, 40, NV1.melnonvegfood);
PS1.costCalculation();
PS1.printcost(PS1.totalcost);
PS1.getDiscount();
PS1.printcost();
TemporarilyStudent TS1 = new TemporarilyStudent(13, 30);
TS1.setInformation("Alif Bhuiyan", "S102", "19.5", "3.85");
TS1.printinformation();
TS1.cost_of_TemporarilyStudent(2, DB1.rentPDay, DB1.numberOfBed);
TS1.cost_of_TemporarilyStudent(2, V1.melvegfood);
TS1.costCalculation();
TS1.printcost(TS1.totalcost);
TS1.getDiscount();
TS1.printcost();
TemporarilyStudent TS2 = new TemporarilyStudent(13, 30);
TS2.setInformation("Alve Bhuiyan", "S103", "21 Years", "3.90");
TS2.printinformation();
TS2.cost_of_TemporarilyStudent(2, DB1.rentPDay, DB1.numberOfBed);
TS2.cost_of_TemporarilyStudent(2, NV1.melnonvegfood);
TS2.costCalculation();
TS2.printcost(TS2.totalcost);
TS2.getDiscount();
TS2.printcost();
System.out.println("\n*******Room Details*******");
SR1.SingleBedRoom();
SR1.setRoomInfo("R101", "6 X 7 Foot", "2");
SR1.printRoomInfo();
SR1.StudentId(SR1.roomNumber, PS1.sId);
SR1.printSID();
DB1.DoubleBedRoom();
DB1.setRoomInfo("R201", "10 X 10 Foot", "3");
DB1.printRoomInfo();
DB1.info();
DB1.StudentId(TS1.sId, TS2.sId, DB1.roomNumber);
DB1.printSID();
}
}