/** * Name: Erica Eddy * Course: CSCI 241 - Computer Science I * Section: 001 or 002 * Assignment: 1 */ import java.util.*; public class MultTable { public static void main (String [] args) { int rows = 5; int cols = 10; // print the header line // add these lines for step 3 System.out.print(" |"); for (int i = 1; i <= 10; i++) System.out.printf("%4d",i); System.out.println(); // print the dashes // add these lines for step 4 System.out.print("---"); for (int i = 0; i < 10; i++) System.out.print("----"); System.out.println(); // the outer loop controls which row we are printing // remember when we set the outer loop to run from r=1 to r=1, // we printed one row (with all columns) for (int r = 1; r <= rows; r++) { System.out.print(" " + (r) + "|"); // the inner loop runs completely from start to finish, // every time we get a new value for r for (int c = 1; c <= cols; c++) { // format lines for step 2 int product = (c ) * (r); System.out.printf ("%4d",product); } // end inner for loop System.out.println(); } // end outer for loop } // end main() method }