- Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathHospital.java
98 lines (86 loc) · 2.4 KB
/
Hospital.java
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
importjava.util.*;
classPatient {
Stringpid, name, age, gender, address, mobnumber;
voidgetData() {
Scannersc = newScanner(System.in);
pid = sc.nextLine();
sc.nextLine();
name = sc.nextLine();
sc.nextLine();
age = sc.nextLine();
sc.nextLine();
gender = sc.nextLine();
sc.nextLine();
address = sc.nextLine();
sc.nextLine();
mobnumber = sc.nextLine();
}
voiddisplayData() {
System.out.println(pid);
System.out.println(name);
System.out.println(age);
System.out.println(gender);
System.out.println(address);
System.out.println(mobnumber);
}
}
classIn_patientextendsPatient {
Stringroomnumber;
doubleconsultationfee, testfee;
Stringdoa, dischargedate;
intnumberofdays;
doubleroomrent;
voidgetData() {
super.getData();
Scannersc = newScanner(System.in);
roomnumber = sc.nextLine();
sc.nextLine();
consultationfee = sc.nextDouble();
sc.nextLine();
testfee = sc.nextDouble();
sc.nextLine();
doa = sc.nextLine();
sc.nextLine();
dischargedate = sc.nextLine();
sc.nextLine();
numberofdays = sc.nextInt();
sc.nextLine();
roomrent = sc.nextDouble();
}
voiddisplayData() {
super.displayData();
System.out.println(roomnumber);
System.out.println(consultationfee);
System.out.println(testfee);
System.out.println(doa);
System.out.println(dischargedate);
System.out.println(numberofdays);
System.out.println(roomrent);
}
}
classBillextendsIn_patient {
Stringdateofbill;
doubletotalamt;
voidgetData() {
super.getData();
Scannersc = newScanner(System.in);
System.out.print("Enter date of bill");
dateofbill = sc.nextLine();
}
voiddisplayData() {
super.displayData();
System.out.println(dateofbill);
}
voidcalculateTotalBillAmount() {
totalamt = consultationfee + testfee + (numberofdays * roomrent);
System.out.println("Total amt is : " + totalamt);
}
}
classHospital {
publicstaticvoidmain(Stringargs[]) {
Billbill1 = newBill();
bill1.getData();
bill1.displayData();
bill1.calculateTotalBillAmount();
}
}