-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShip.java
More file actions
104 lines (96 loc) · 2.38 KB
/
Ship.java
File metadata and controls
104 lines (96 loc) · 2.38 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import java.util.Scanner;
public class Ship
{
private Person captain;
public String currentLocation = "Lisbon";
public int distanceTravel = 0;
private String name;
public int speed = 5;
public double dayCount = 0;
public Ship(Person captain, String name)
{
this.captain = captain;
this.name = name;
}
public static int PassageSel()
{
Scanner input = new Scanner(System.in);
System.out.println();
System.out.println("'1' : Northwest Passage");
System.out.println("'2' : There be dragons");
System.out.println("'3' : Ferdinand and Isabella");
System.out.println("Which route would you like to take?");
int sel = input.nextInt();
return sel;
}
public void Status()
{
System.out.println(name +":"+ captain);
System.out.println("Distance:"+distanceTravel);
System.out.println("Speed: "+speed);
System.out.printf("Day: %2.0f\n",dayCount);
System.out.println("Current Location:"+ currentLocation);
System.out.println();
}
public void passageOne()
{
this.currentLocation = "Atlantic Ocean";
while (this.distanceTravel<4200)
{
if (this.distanceTravel == 3000)
this.speed = 1;
if (this.distanceTravel%200 == 0)
this.Status();
this.distanceTravel += (this.speed);
this.dayCount +=(.041667);
}
if (this.distanceTravel==4200)
this.currentLocation = "Carribean";
this.Status();
}
public void passageTwo()
{
this.currentLocation = "Atlantic Ocean";
while (this.distanceTravel<4200)
{
if (this.distanceTravel == 2500)
{
if ((this.captain.toString().equals("Columbus")))
{
this.speed = 0;
break;
}
else if ((this.captain.toString().equals("Quint")))
{
this.speed = 0;
break;
}
else if ((this.captain.toString().equals("Nemo")))
this.speed = 3;
}
if (this.distanceTravel%200 == 0)
this.Status();
this.distanceTravel += (this.speed);
this.dayCount +=(.041667);
}
if (this.distanceTravel>=4200)
this.currentLocation = "Carribean";
this.Status();
}
public void passageThree()
{
this.currentLocation = "Atlantic Ocean";
while (this.distanceTravel<4200)
{
if (this.distanceTravel == 500)
this.speed = 10;
if (this.distanceTravel%200 == 0)
this.Status();
this.distanceTravel += (this.speed);
this.dayCount +=(.041667);
}
if (this.distanceTravel==4200)
this.currentLocation = "Carribean";
this.Status();
}
}