-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmdagain.java
More file actions
75 lines (58 loc) · 1.81 KB
/
Copy pathmdagain.java
File metadata and controls
75 lines (58 loc) · 1.81 KB
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
class eduinstitute {
String insname;
String location;
int estyear;
eduinstitute(String in, String loc, int esy) {
insname = in;
location = loc;
estyear = esy;
}
int calculateage() {
return 2025 - estyear;
}
void displaydetail() {
System.out.println("Name of the institute : " + insname);
System.out.println("Location of the institute : " + location);
System.out.println("Established year of the institute : " + estyear);
}
}
class highschool extends eduinstitute {
String schooltype;
int numberofst;
highschool(String in, String loc, int esy, String sct, int nst) {
super(in, loc, esy);
schooltype = sct;
numberofst = nst;
}
@Override
void displaydetail(){
super.displaydetail();
System.out.println("Type of the institute : "+schooltype);
System.out.println("Number of the institute student : "+numberofst);
}
}
class University extends eduinstitute {
int NUMofdep;
Boolean isresearh;
University(String in,String loc,int esy,int dep,Boolean is){
super(in,loc,esy);
NUMofdep=dep;
isresearh=is;
}
@Override
void displaydetail() {
super.displaydetail();
System.out.println ("Number of Department : " + NUMofdep);
System.out.println ("Is research Center : " + (isresearh ? "yes" : "NO"));
}
}
public class mdagain {
public static void main(String[] args) {
highschool h1= new highschool("g x school","cth", 2010,"public",40);
h1.displaydetail();
System.out.println("Age of institute : "+ h1.calculateage());
University u1= new University("iiuc","bangladesh",2004,12,true);
u1.displaydetail();
System.out.println("Age of institute : "+ u1.calculateage());
}
}