/**********************************************************************
 * Build a multiplication table
 * Non-Object Oriented 
 *********************************************************************/

public class Mult
{
    public static void main(String[ ] args)
    {
        table(10, 10);                          //call the mult() method 10,10

        System.out.println("--------");         //print a new line

        int maxRow = getRandom(1,10);           //random number 1 - 10       
        int maxCol = getRandom(1,10);           //random number 1 - 10       

        table(maxRow, maxCol);                  //call the mult() method with rand Row,Col
    }   
    
    //--- getRandom method ------------------------------------------------------

    static int getRandom(int min, int max)              //get min value & max value
    {
        int rand;                                       //create a local variable
        rand = (int) (Math.random() * (max-min+1));     //random dist over max-min
        rand = rand + min;                              //add the minimum value
        return (rand);                                  //return the random number
    }

    //--- mult table method ------------------------------------------------------

    static void table(int maxRow, int maxCol)
    {   
        int row, col, colHead, result;
    
        for (colHead = 1; colHead <= maxCol; colHead++)     //create loop for col headers
            System.out.print("\t<" + colHead + ">");                                                        
       
        System.out.println();                               //print a new line
 
        for (row = 1; row <= maxRow; row++)                 //create a for loop for rows
        {
            System.out.print("<" + row + ">\t");            //print the row header
            
            col = 1;            
            while (col <= maxCol)                           //create a while loop for columns
            {
                result = row * col;
                System.out.print(" " + result + "\t");
                col++;
            }                                               
            System.out.println();                           //print a new line
        }
    }
}