/* Punters Lounge JAVA programming course * * Lesson32.java * * Required file/class : Scoreboard.class * * * Author : Erik Datapunter * Date : 28/apr/2004 * * Displays a football scoreboard. * */ public class Lesson32 { 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("Draw game"); } // if not a Draw... else { // ...then Home or Away win ? if (Localgame.home < Localgame.away) { // Home score smaller than Away score System.out.println("Away win"); } else { // Home score bigger than Away score System.out.println("Home win"); } } } }