-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathU2.java
More file actions
33 lines (30 loc) · 744 Bytes
/
U2.java
File metadata and controls
33 lines (30 loc) · 744 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
import java.util.Random;
public class U2 extends Rocket {
U2() {
cost = 120;
weight = 18000;
maxWeight = 29000;
}
@Override
public boolean land() {
Random rand = new Random();
double chance = 1.0/((8.0/100.0)*((double )weight/(double )maxWeight));
if(rand.nextInt((int )chance) == 0) {
return false;
}
else {
return true;
}
}
@Override
public boolean launch() {
Random rand = new Random();
double chance = 1.0/((4.0/100.0)*((double )weight/(double )maxWeight));
if(rand.nextInt((int )chance) == 0) {
return false;
}
else {
return true;
}
}
}