/* Punters Lounge JAVA programming course * * Lesson34.java * * Required file/class : Scoreboard.class * * * Author : Erik Datapunter * Date : 28/apr/2004 * * Displays a football scoreboard and calculates a bet on the Home team * */ public class Lesson34 { public static void main(String[] args) { // variables used int Bank = 1000; int Bet = 100; int Odds = 3; // creating a Scoreboard object Scoreboard Localgame = new Scoreboard(0,0); // fill the scoreboard with a game result Localgame.home = 1; Localgame.away = 0; // display the score System.out.println(Localgame.home); System.out.println(Localgame.away); // check for a Draw game, bet loses if (Localgame.home == Localgame.away) { System.out.println("Today's game ended in a Draw with "+Localgame.home+" goals for each team"); Bank = Bank - Bet; System.out.println("Draw game, bank = "+Bank); } // if not a Draw then... else { // check Home win or Away win if (Localgame.home < Localgame.away) { // Away win, bet loses System.out.println("Today's game ended in an Away Win with a total of "+Localgame.goals()+" goals scored"); Bank = Bank - Bet; System.out.println("Away win, bank = "+Bank); } else { // Home win, bet wins System.out.println("Today's game ended in a Home Win with a total of "+Localgame.goals()+" goals scored"); Bank = (Bank - Bet) + (Bet * Odds); System.out.println("Home win, bank = "+Bank); } } } }