Fixed a bunch of stuff inside of Travel, but also discovered a MASSIVE problem with our code

This commit is contained in:
2019-02-19 19:03:51 -07:00
parent 297a58551b
commit 945021459e

View File

@@ -4,28 +4,34 @@ import java.util.Scanner;
public class Travel extends Player { public class Travel extends Player {
private void seaAtlas(int locationOfTravel){ private void seaAtlas(int locationOfTravel){
setLocation(locationOfTravel);
switch (locationOfTravel) { switch (locationOfTravel) {
case 1: case 1:
System.out.println("\nArriving at Hong Kong"); System.out.println("\nArriving at Hong Kong");
setLocation(1);
break; break;
case 2: case 2:
System.out.println("\nArriving at Shanghai"); System.out.println("\nArriving at Shanghai");
setLocation(2);
break; break;
case 3: case 3:
System.out.println("\nArriving at Nagasaki"); System.out.println("\nArriving at Nagasaki");
setLocation(3);
break; break;
case 4: case 4:
System.out.println("\nArriving at Saigon"); System.out.println("\nArriving at Saigon");
setLocation(4);
break; break;
case 5: case 5:
System.out.println("\nArriving at Manila"); System.out.println("\nArriving at Manila");
setLocation(5);
break; break;
case 6: case 6:
System.out.println("\nArriving at Singapore"); System.out.println("\nArriving at Singapore");
setLocation(6);
break; break;
case 7: case 7:
System.out.println("\nArriving at Batavia"); System.out.println("\nArriving at Batavia");
setLocation(7);
break; break;
} }
} }
@@ -75,6 +81,7 @@ public class Travel extends Player {
response = keyboard.nextLine(); response = keyboard.nextLine();
try { try {
tempInt = Integer.parseInt(response); tempInt = Integer.parseInt(response);
System.out.println(tempInt + " " + getLocation());
if(tempInt != getLocation()){ if(tempInt != getLocation()){
randomEventSea(tempInt); randomEventSea(tempInt);
seaAtlas(tempInt); seaAtlas(tempInt);