Changed switch to Enhanced Switch.
This commit is contained in:
parent
5f37a3a97b
commit
00edd1e95d
@ -30,7 +30,7 @@ public class FakeCoin extends Application {
|
|||||||
@Override
|
@Override
|
||||||
public void executeOption(int option) {
|
public void executeOption(int option) {
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case 1:
|
case 1 -> {
|
||||||
System.out.println("Please enter a number of coins in the pile (including fake coin).");
|
System.out.println("Please enter a number of coins in the pile (including fake coin).");
|
||||||
System.out.print("Coin Count: ");
|
System.out.print("Coin Count: ");
|
||||||
int numOfCoins = this.getIntegerInput();
|
int numOfCoins = this.getIntegerInput();
|
||||||
@ -41,13 +41,12 @@ public class FakeCoin extends Application {
|
|||||||
numOfCoins = this.getIntegerInput();
|
numOfCoins = this.getIntegerInput();
|
||||||
}
|
}
|
||||||
this.pile = new Coin[numOfCoins];
|
this.pile = new Coin[numOfCoins];
|
||||||
break;
|
}
|
||||||
case 2:
|
case 2 -> {
|
||||||
if (this.pile == null) {
|
if (this.pile == null) {
|
||||||
System.out.println("Please specify a number of coins before setting the fake location.");
|
System.out.println("Please specify a number of coins before setting the fake location.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Please specify a location for the fake coin. Between 0 and " + (this.pile.length - 1));
|
System.out.println("Please specify a location for the fake coin. Between 0 and " + (this.pile.length - 1));
|
||||||
System.out.print("Location: ");
|
System.out.print("Location: ");
|
||||||
int location = this.getIntegerInput();
|
int location = this.getIntegerInput();
|
||||||
@ -66,14 +65,14 @@ public class FakeCoin extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setLocation = true;
|
this.setLocation = true;
|
||||||
break;
|
}
|
||||||
case 3:
|
case 3 -> {
|
||||||
if (!this.setLocation) {
|
if (!this.setLocation) {
|
||||||
System.out.println("Please specify the fake coins location.");
|
System.out.println("Please specify the fake coins location.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.performAlgorithm();
|
this.performAlgorithm();
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user