Advertisement
Arush22

Untitled

Dec 13th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. package com.Suarez;
  2. // Arush Adabala
  3. // 12/13/2018
  4. // This Program prints a series of back slashes and forward slashes. It creates Challenge 1.
  5.  
  6. public class ChallengeCopy {
  7.  
  8. public static final int SIZE = 4;
  9.  
  10. public static void main(String[] args)
  11. {
  12. BreakLine();
  13. Top();
  14. Bottom();
  15. BreakLine();
  16. Bottom();
  17. Top();
  18. BreakLine();
  19. }
  20. public static void BreakLine ()
  21. {
  22. System.out.print("+");
  23. for(int i=1;i<=2*SIZE+1;i++)
  24. {
  25. System.out.print("-");
  26. }
  27. System.out.println("+");
  28. }
  29. public static void Top () {
  30.  
  31. for (int interval = 1; interval <= SIZE; interval++)
  32. {
  33. System.out.print("|");
  34. for (int space = SIZE-interval; space >= 0; space--) {
  35. System.out.print(" ");
  36. }
  37. for (int slash = SIZE-interval; slash <= SIZE-2; slash++) {
  38. System.out.print("/");
  39. }
  40. System.out.print("*");
  41. for (int slash = SIZE-interval; slash <= SIZE-2; slash++) {
  42. System.out.print("\\");
  43. }
  44. for (int space = SIZE-interval; space >= 0; space--) {
  45. System.out.print(" ");
  46. }
  47. System.out.println("|");
  48. }
  49. }
  50. public static void Bottom () {
  51.  
  52. for (int interval = SIZE; interval >= 1; interval--)
  53. {
  54. System.out.print("|");
  55. for (int space = SIZE-interval; space >= 0; space--) {
  56. System.out.print(" ");
  57. }
  58. for (int slash = SIZE-interval; slash <= SIZE-2; slash++) {
  59. System.out.print("\\");
  60. }
  61. System.out.print("*");
  62. for (int slash = SIZE-interval; slash <= SIZE-2; slash++) {
  63. System.out.print("/");
  64. }
  65. for (int space = SIZE-interval; space >= 0; space--) {
  66. System.out.print(" ");
  67. }
  68. System.out.println("|");
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement