public static double tripleBet(Dice dice, double betAmount) {
double payout = 0.0;
double three_rolled = 3;
if (dice.getFirst() == dice.getSecond() && dice.getThird() == dice.getFirst()) {
payout = betAmount * three_rolled;
} else {
payout = -betAmount;
}
return payout;
}
Here I am comparing die in a game called "Chuck-a-luck." I need to simply return a payout amount if the player has bet the dice will all be the same.
The expression in the conditional statement is my main concern. I'd like to know if it is valid or "good practice" to write like this.
Any other advice is welcomed as well.