/* Punters Lounge JAVA programming course * * Lesson51.java * * Author : Erik Datapunter * Date : 28/apr/2004 * * Handling Football odds and results. * */ public class Lesson51 { public static void main(String[ ] arguments) { // an Array of 10 rows and 3 columns, respectively 10 matches and 3 odds per match double[][] FootballOdds = new double[10][3]; // variable names used to acess the info in the Array int FOhome = 0; int FOdraw = 1; int FOaway = 2; // variable used to calculate theoverround double Overround = 0; // a list of 10 football matches with 3 odds each, Home Draw, Away FootballOdds[0][FOhome] = 2.52; FootballOdds[0][FOdraw] = 3.3; FootballOdds[0][FOaway] = 2.46; FootballOdds[1][FOhome] = 1.9; FootballOdds[1][FOdraw] = 3.35; FootballOdds[1][FOaway] = 3.85; FootballOdds[2][FOhome] = 1.5; FootballOdds[2][FOdraw] = 3.75; FootballOdds[2][FOaway] = 5.5; FootballOdds[3][FOhome] = 1.82; FootballOdds[3][FOdraw] = 3.3; FootballOdds[3][FOaway] = 3.5; FootballOdds[4][FOhome] = 2.12; FootballOdds[4][FOdraw] = 3.25; FootballOdds[4][FOaway] = 3.5; FootballOdds[5][FOhome] = 2.42; FootballOdds[5][FOdraw] = 3.25; FootballOdds[5][FOaway] = 2.54; FootballOdds[6][FOhome] = 1.85; FootballOdds[6][FOdraw] = 3.35; FootballOdds[6][FOaway] = 4; FootballOdds[7][FOhome] = 1.65; FootballOdds[7][FOdraw] = 3.5; FootballOdds[7][FOaway] = 4.5; FootballOdds[8][FOhome] = 2.36; FootballOdds[8][FOdraw] = 3.25; FootballOdds[8][FOaway] = 3.05; FootballOdds[9][FOhome] = 1.12; FootballOdds[9][FOdraw] = 10.5; FootballOdds[9][FOaway] = 34; // do it 10 times, once for each match int matchloop; for ( matchloop = 0 ; matchloop < 10 ; matchloop = matchloop + 1 ) { // calculate and display the overround Overround = ( 1 / FootballOdds[matchloop][FOhome]) + ( 1 / FootballOdds[matchloop][FOdraw]) + ( 1 / FootballOdds[matchloop][FOaway]); Overround = Overround * 100; System.out.println("Match "+matchloop+" = "+Overround); } } }