how to format data tables
I am very new to java and need to create a data table that shows the growth statistics of a website for three different age groups over 5 years.
I have entered the data into three arrays, group13_24, group25_54, and group55plus, but I cannot figure out how to print the data table in the correct format, with column and row headers.
This is what I have so far for printing out the table:
String[] columnNames = { "13-24", "25-54", "55 +"};
int[][] numbers = { group13_24, group25_54, group55plus };
for (int i = 0; i < numbers.length; i++) {
for (int j = 0; j < numbers.length; j++) {
out.format("%10d", numbers[i][0])
I need my output to look like this:
13-24 25-54 55+
----- ----- -----
2005:
2006:
2007:
2008:
2009:
I have been working on this for a while now but cant seem to figure it out :confused: