-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop3.java
More file actions
105 lines (51 loc) · 1.56 KB
/
Copy pathoop3.java
File metadata and controls
105 lines (51 loc) · 1.56 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
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
import java.util.Scanner;
class character{
public String name;
public void display_character(){
Scanner s1 = new Scanner(System.in);
System.out.println("enter character name");
name = s1.nextLine();
System.out.printf("\n %s can move\n",name);
System.out.printf("\n %s can speak\n",name);
}
}
class Germs extends character{
public String disease;
public void GermsDisease(String disease){
super.display_character();
System.out.printf("\n %s has a %s disease \n",name,disease);
System.out.printf("\n %s can spread this disease \n ",name);
}
}
class SpecialGerms extends Germs{
public void flyingGerms(){
super.display_character();
System.out.printf("\n %s is a special germ and it can fly\n",name);
}
}
class Human extends character{
public void washHands(){
super.display_character();
System.out.printf("\n %s is a human and he is wahing his hands\n",name);
}
}
class Protector extends Human{
public void Protector(){
System.out.println("\n Commander safeguard is the protector \n");
System.out.println("Commander safeguard has a team of special kids and doctors");
}
}
class Test_Inheritance{
public static void main(String args[]){
character dirto = new character();
Germs satchi = new Germs();
Human human1 = new Human();
SpecialGerms ghumsunna = new SpecialGerms();
Protector SafeGuard = new Protector();
dirto.display_character();
satchi.GermsDisease("malaria");
human1.washHands();
ghumsunna.flyingGerms();
SafeGuard.Protector();
}
}