Below is the required code of Java programming language.
Java
Program code:
//Creating a main class
class Main
{
//Using int[] to store integer variables
public static void fillTable(int [][] t, int or, int oc)
{
//Creating a for loop
for(int r=0; r<t.length; r++)
{
for(int c=0; c<t[r].length; c++)
{
//Using Matt.abs to return the number's absolute value
t[r][c] = Math.max(1+Math.abs(r-or), 1+Math.abs(c-oc));
}
}
}
public static void dumpTable(int [][] t)
{
//Again a for loop
for(int r=0; r<t.length; r++)
{
for(int c=0; c<t[r].length; c++)
{
System.out.printf("%3d", t[r][c]);
}
//Printing the values or the text
System.out.println();
}
}
//Main method
public static void main(String[] args)
{
//Declaring the variables
int origin_row = 3;
int origin_col = 2;
//Declaring array
int[][] table = new int[5][4];
fillTable(table, origin_row, origin_col);
dumpTable(table);
}
}
Explanation:
- Creating a main class.
- Using int[] to store integer variables.
- Creating a for loop.
- Using Matt.abs to return the number's absolute value.
- Again using a for loop.
- Printing the values or the text.
- Main method.
- Declaring the variables.
- Declaring array.
Output:
Please find below the attachment of the program code.
Find out more information about Java here:
https://brainly.com/question/26642771