Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. //Code Written by Evan Behrendt 11/29/16 Picture lab 12.2
  2. public class PictureMethod
  3. {
  4. private int row;
  5. private int column;
  6. private int pyramid;
  7.  
  8. public PictureMethod(int r, int c, int p)
  9. {
  10. row = r;
  11. column = c;
  12. pyramid = p;
  13.  
  14. }
  15.  
  16. public void numTable(int row, int column)
  17. {
  18. if (row <= 12 && column <= 12)
  19. {
  20. System.out.printf("");
  21. for (int h = 1; h <= column; h++)
  22. {
  23. System.out.printf("\t" + h);
  24. }
  25. System.out.println("\n");
  26. for (int r = 1; r <= row; r++)
  27. {
  28. System.out.print(r+"\t");
  29.  
  30. for (int c = 1; c <= column; c++)
  31. {
  32. System.out.printf(c * r + "\t");
  33. }
  34. System.out.println("");
  35. }
  36. }
  37. }
  38.  
  39. public void Pyramid(int L)
  40. {
  41. for (int row = 1; row <= L; row++)
  42. {
  43. for (int space = 1; space <= L - row; space++)
  44. {
  45. System.out.print(" ");
  46. }
  47. for (int star = 1; star <= 1 + 2 * (row - 1); star++)
  48. {
  49. System.out.print("*");
  50. }
  51. System.out.println("");
  52. }
  53.  
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement