Code:What the right way to declare a 3 dimensional array i.e depot name bus no destination journey time crewe 80a London 120 crewe 70 liverpool 90 crewe 60b Newcastle 50 Manchester 40c Glasgow 90 Glasgow 40c leeds 45 Would it be String[] buses = {{ crewe , 80a, London, 120}, {crewe, 70, Liverpool, 90}, {crewe, 60b, Newcastle, 50}, {Manchester, 40c, Glasgow, 90}, {Glasgow, 40c, leeds , 45},}; is it the way you would do it, because each depot could have up to 5 buses leaving each day, I would have to leave room for 5 buses in each depot this must be wrong. As I would end up with {{ crewe , 80a, London, 120}, {crewe, 70, Liverpool, 90}, {crewe, 60b, Newcastle, 50}, {crewe, 0, 0, 0}, {crewe, 0, 0, 0}, 3 depots using 15 rows * 4 colums is that right




Reply With Quote