Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Code Written by Evan Behrendt 11/29/16 Picture lab 12.2
- public class PictureMethod
- {
- private int row;
- private int column;
- private int pyramid;
- public PictureMethod(int r, int c, int p)
- {
- row = r;
- column = c;
- pyramid = p;
- }
- public void numTable(int row, int column)
- {
- if (row <= 12 && column <= 12)
- {
- System.out.printf("");
- for (int h = 1; h <= column; h++)
- {
- System.out.printf("\t" + h);
- }
- System.out.println("\n");
- for (int r = 1; r <= row; r++)
- {
- System.out.print(r+"\t");
- for (int c = 1; c <= column; c++)
- {
- System.out.printf(c * r + "\t");
- }
- System.out.println("");
- }
- }
- }
- public void Pyramid(int L)
- {
- for (int row = 1; row <= L; row++)
- {
- for (int space = 1; space <= L - row; space++)
- {
- System.out.print(" ");
- }
- for (int star = 1; star <= 1 + 2 * (row - 1); star++)
- {
- System.out.print("*");
- }
- System.out.println("");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement