/* Punters Lounge JAVA programming course * * Lesson22.java * * Author : Erik Datapunter * Date : 28/apr/2004 * * Calculates a winning or losing bet * */ public class Lesson22 { public static void main(String[ ] args) { // variables used int Bank = 1000; int Bet = 100; int Odds = 3; // changed WinLose to 1 so it becomes a winning bet, // any other value that 0 or 1 and bet is void int WinLose = 1; // IF the bet loses if (WinLose == 0) { // bet loses, subtract Bet from Bank Bank = Bank - Bet; } if (WinLose == 1) { // bet wins, subtract Bet from Bank, add return being Bet times Odds Bank = (Bank - Bet) + (Bet * Odds); } // in case WinLose is not 0 or 1 the bet is void so the Bank remains the same // print new Bank on the screen System.out.println(Bank); } }