/* Punters Lounge JAVA programming course * * Lesson33.java * * Required file/class : Scoreboard.class * * * Author : Erik Datapunter * Date : 28/apr/2004 * * Displays a football scoreboard. * */ public class Lesson33 { public static void main(String[] args) { // create a new Scoreboard object and name it Localgame Scoreboard Localgame = new Scoreboard(0,0); // fill the scoreboard with a game score Localgame.home = 1; Localgame.away = 2; // display the game score, being the state of the object System.out.println(Localgame.home); System.out.println(Localgame.away); // first check for a Draw game if (Localgame.home == Localgame.away) { System.out.println("Today's game ended in a Draw with "+Localgame.home+" goals for each team"); } // if not a Draw... else { // ...then Home or Away win ? if (Localgame.home < Localgame.away) { System.out.println("Today's game ended in an Away Win with a total of "+Localgame.goals()+" goals scored"); } else { System.out.println("Today's game ended in a Home Win with a total of "+Localgame.goals()+" goals scored"); } } } }