Home Segments Top Top Previous Next

535: Practice

You easily can define arrays with more than one dimension: You simply add more bracketed dimension sizes. For example, to define a double array with 2 rows and 100 columns, you proceed as follows:

double 2DArray [] [] = new double[2][100]; 

Amend the program you were asked to write in Segment 502 such that it writes scores into an array with 2 rows and 160 columns. Then, display not only the won–lost record, but also the average difference between your team's score and the opponent's score for games won and for games lost.