// Project: StaticMethods // No modules defined. // Source code file: PrintPowers.java // Print table of the values, squares, cubes, // and 4th powers of ints from 1 to 10. public class PrintPowers { public static void main(String[] args) { printPowers(10); } public static void printPowers(int maxRows) { System.out.println( "Value Square Cube 4th Power"); System.out.println( "===== ====== ==== ========="); for(int row = 1; row <= maxRows; row++) { System.out.printf( " %2d %3d %4d %5d\n", row, row*row, row*row*row, row*row*row*row); } } }