-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathques.java
More file actions
67 lines (57 loc) · 1.68 KB
/
Copy pathques.java
File metadata and controls
67 lines (57 loc) · 1.68 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
class educationalinstitution {
String name;
String location;
int estyear;
educationalinstitution(String n, String l, int y) {
name = n;
location = l;
estyear = y;
}
int calculateage() {
return 2025 - estyear;
}
void display() {
System.out.println("Name of institute :" + name);
System.out.println("Name of Location :" + location);
System.out.println("established year :" + estyear);
}
}
class highschool extends educationalinstitution {
String type;
int numberofst;
highschool(String n, String l, int y, String type, int nst) {
super(n, l, y);
this.type = type;
numberofst = nst;
}
@Override
void display() {
super.display();
System.out.println("type of high school :" + type);
System.out.println("number of student :" + numberofst);
}
}
class university extends educationalinstitution {
int numofdep;
boolean isresearch;
university(String n, String l, int y, int dep, boolean research) {
super(n, l, y);
numofdep = dep;
isresearch = research;
}
@Override
void display() {
super.display();
System.out.println("Number of department :" + numofdep);
System.out.println("is this research center :" + (isresearch ? "yes" : "NO"));
}
}
public class ques {
public static void main(String[] args) {
highschool hg = new highschool("Munivciple", "ctg", 1973, "public", 600);
hg.display();
System.out.println("Age of school" + hg.calculateage());
university U = new university("iiuc", "ctg", 2000, 12, true);
U.display();
}
}