-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
49 lines (49 loc) · 2.3 KB
/
Main.java
File metadata and controls
49 lines (49 loc) · 2.3 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
public class Main {
public static void main (String[] args){
Human freken = new Human("Френекен Бок", Human.Gender.Female,false,Human.BootsTypeOn.None,Human.StandsOn.Parket);
Human karlson = new Human("Карлсон",Human.Gender.Male,true, Human.BootsTypeOn.Sneakers);
NotGiveUp notGiveUp = ()-> {
return true;
};
int notGiveUpCount = freken.getCountNotGiveUp();
try {
Human.GetGender.get(freken);
}
catch (NoGenderException e)
{
System.out.println("У персонажа " + freken.name + " нет пола");
}
while (notGiveUp.getNotGiveUp() == true){
Flying flyAction = new Flying(){
public void flyLower(Human o){
if (o.flyingType) System.out.println(o.name + " опутистился");
else System.out.println(o.name + " не может летать");
}
public void flyHigher(Human o){
if (o.flyingType) System.out.println(o.name + " взлетел выше и увернулся");
else System.out.println(o.name + " не может летать");
}
};
HumanActions action = new HumanActions(){
public void catchHuman(Human o, Human c){
System.out.println("Человек " + o.name + " пытается поймать " + c.name);
}
public void swish (SwingableObjects o, Human h, Human p){
System.out.println(h.name + " размахивает предметом " + o + ", чтобы сбить " + p.name);
}
public void jump (Human h){
System.out.println(h.name + " подпрыгивает");
}
};
action.catchHuman(freken,karlson);
flyAction.flyHigher(karlson);
action.swish(SwingableObjects.Beater,freken, karlson);
freken.getShoes();
action.jump(freken);
freken.setCountNotGiveUp(notGiveUpCount++);
if (notGiveUpCount > 3){
throw new NotGiveUpException(freken);
}
}
}
}