forked from rick2785/JavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemyRobot.java
More file actions
35 lines (18 loc) · 705 Bytes
/
EnemyRobot.java
File metadata and controls
35 lines (18 loc) · 705 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
26
27
28
29
30
31
32
33
34
35
// This is the Adaptee. The Adapter sends method calls
// to objects that use the EnemyAttacker interface
// to the right methods defined in EnemyRobot
import java.util.Random;
public class EnemyRobot{
Random generator = new Random();
public void smashWithHands() {
int attackDamage = generator.nextInt(10) + 1;
System.out.println("Enemy Robot Causes " + attackDamage + " Damage With Its Hands");
}
public void walkForward() {
int movement = generator.nextInt(5) + 1;
System.out.println("Enemy Robot Walks Forward " + movement + " spaces");
}
public void reactToHuman(String driverName) {
System.out.println("Enemy Robot Tramps on " + driverName);
}
}