// NestedForLoops.java
// Nested for loops summing an array
import java.awt.*;
import javax.swing.JApplet;

public class NestedForLoops extends JApplet {

	int sales[ ][ ] = { { 10, 5, 3, 2 }, { 20, 4, 8, 4 }, { 6, 10, 7, 10 } };
	int total;

	public void paint( Graphics g ) {
		for ( int row = 0; row <= 2; row++ ) {
			for ( int col = 0; col <= 3; col++ ) {
				total += sales[ row ][ col ];
			}
		}
		
		g.drawString( "The total sales is " + Integer.toString( total ), 25, 25 );
	}
}