-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRacingApp.java
More file actions
25 lines (19 loc) · 915 Bytes
/
Copy pathRacingApp.java
File metadata and controls
25 lines (19 loc) · 915 Bytes
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
package Question11;
import java.security.SecureRandom;
import java.util.Arrays;
import static Question11.ForestAnimal.Builder;
public class RacingApp {
public static void main(String[] args) {
ForestAnimal horse = new Builder().setName("Con ngua").setSpeech(generationAnimalSeech(60))
.setFlyable(false).build();
ForestAnimal tiger = new Builder().setName("Con ho").setSpeech(generationAnimalSeech(100))
.setFlyable(false).build();
ForestAnimal eagle = new Builder().setName("Con eagle").setSpeech(generationAnimalSeech(70))
.setFlyable(false).build();
ForestAnimal thewinner = new ForrestRacingController().getWinner(Arrays.asList(horse,tiger,eagle));
System.out.println(thewinner);
}
private static int generationAnimalSeech(int maxSpeech){
return new SecureRandom().nextInt(maxSpeech) +1;
}
}