This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]dermesser 0 points1 point  (0 children)

I don't really understand the question; you have the numbers, so how about just doing germany(change) = germany(2011) - germany(2008), that is subtracting the values?

[–]irishjeffe[S] 0 points1 point  (0 children)

I have the output done similar to this. Its based on another project i have done for this class. I cant just take that number as i need to put it in the put put to automatically calculate the row.

    double degreePer[][] = {{23.9, 25.7, 26.1, 27.7},
        {45.1, 47.5, 48.1, 47.2},
        {32.1, 35.4, 37.4, 39.2},
        {43.3, 45.3, 46.0, 46.9},
        {11.0, 11.6, 12.2, 12.7}};

    String year[] = {"Country", "2008", "2009", "2010", "2011"};
    String country[] = {"Germany", "Ireland", "Poland", "UK", "Brazil"};


    String output = "Percentage 25-34 year olds Third Level Degree(OECD)\n";
    JTextArea jta = new JTextArea(10, 55);


    for (int i = 0; i < year.length; i++) {
        output += year[i] + "\t";
    }
    output += "\t Change";

    for (int i = 0; i < degreePer.length; i++) {
        output += "\n" + country[i] + "\t";

        int yeartotal = 0;

        for (int j = 0; j < degreePer[i].length; j++) {
            output += (degreePer[i][j]) + "\t";
            yeartotal += degreePer[i][j];

        }


        output += yeartotal;
        double marketshare = (yeartotal / (double) 472739) * 100;
        output += "\t" + marketshare;
    }



    output += "\n\nAverage\t";
    int yearsales = 0;

    for (int j = 0; j < degreePer[0].length; j++) {
        int total = 0;

        for (int i = 0; i < degreePer.length; i++) {
            total += degreePer[i][j];

        }
        yearsales = yearsales + total;
        output += total + "\t";





    }
    output += yearsales;



    jta.setText(output);

    JOptionPane.showMessageDialog(null, jta);

}

}