-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStoryTeller.java
More file actions
38 lines (33 loc) · 1.19 KB
/
StoryTeller.java
File metadata and controls
38 lines (33 loc) · 1.19 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
import exceptions.AbsenceOfAnObjectException;
import humans.Dunno;
import locations.*;
import timeOfDay.DayConditions;
import timeOfDay.TimeOfDay;
public class StoryTeller {
public static void main(String[] args) {
Space space = new Space("Космос");
Planet earth = new Planet("Земля", Cities.getAllCities());
Planet moon = new Planet("Луна");
space.setPlanet(moon);
space.setPlanet(earth);
Rocket rocket = new Rocket("Союз-9000");
earth.setRocket(rocket);
Dunno dunno = new Dunno("Незнайка", earth);
TimeOfDay timeOfDay = new TimeOfDay(DayConditions.EVENING);
dunno.changeLocation(rocket.shelter);
rocket.turnOn();
dunno.sleep();
try {
earth.giveRocketToSpace(space, rocket);
} catch (AbsenceOfAnObjectException exc) {
System.out.println(exc.getMessage());
}
timeOfDay.setCondition(DayConditions.NIGHT);
dunno.wakeUp();
try {
dunno.initRocketActions(space, rocket.engine::createNoise);
} catch (AbsenceOfAnObjectException exc) {
System.out.println(exc.getMessage());
}
}
}