Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ProjectTree{
  4. public static void main(String[] args){
  5. Scanner console = new Scanner(System.in);
  6. System.out.print("Enter the amount of segments: ");
  7. int segment = console.nextInt();
  8. System.out.print("Enter the height: ");
  9. int height = console.nextInt();
  10. createTree(segment, height);
  11. }
  12. public static void createTree (int segment, int height){
  13. for(int line=1; line<=height; line++){
  14. for(int space=segment-line; space>=0; space--){
  15. System.out.print(" ");
  16. }
  17. for(int star=0; star<line*2-1; star++){
  18. System.out.print("*");
  19. }
  20. System.out.println();
  21. }
  22. }
  23. }
  24. //Coded by Juan Seo
  25. public class RocketShip{
  26. public static final int Size = 14;
  27. public static void main(String[] args){
  28. Cone(); //Cone of the RocketShip
  29. Line(); //Divider Line
  30. Body(); //Body of the RocketShip
  31. Line(); //Divider Line repeated
  32. Body(); //Body of the RocketShip repeated
  33. Line(); //Divider Line repeated
  34. Cone(); //Thrust or Cone at the end of the RocketShip repeated
  35. }
  36. public static void Cone() {
  37. for(int line=0; line<Size*2-1; line++){
  38. for(int space=(Size+(Size-1))-1*line; space>0; space--){
  39. System.out.print(" ");
  40. }
  41. for(int slash=0; slash<line+1; slash++){
  42. System.out.print("/");
  43. }
  44. System.out.print("**");
  45. for(int bslash=0; bslash<line+1; bslash++){
  46. System.out.print("\\");
  47. }
  48. System.out.println();
  49. }
  50. }
  51. public static void Line() {
  52. System.out.print("+");
  53. for(int line=0; line<Size*2; line++){
  54. System.out.print("=*");
  55. }
  56. System.out.println("+");
  57. }
  58. public static void Body() {
  59. for(int line=0; line<Size; line++){
  60. System.out.print("|");
  61. for(int space=Size-line; space>1; space--){
  62. System.out.print(".");
  63. }
  64. for(int triangle=line+1; triangle>0; triangle--){
  65. System.out.print("/\\");
  66. }
  67. for(int dot=(Size*2)-((line+1)*2); dot>0; dot--){
  68. System.out.print(".");
  69. }
  70. for(int triangle2=line+1; triangle2>0; triangle2--){
  71. System.out.print("/\\");
  72. }
  73. for(int space2=Size-line; space2>1; space2--){
  74. System.out.print(".");
  75. }
  76. System.out.println("|");
  77. }
  78. for(int line2=0; line2<Size; line2++){
  79. System.out.print("|");
  80. for(int space=line2; space>0; space--){
  81. System.out.print(".");
  82. }
  83. for(int triangle=Size-line2; triangle>0; triangle--){
  84. System.out.print("\\/");
  85. }
  86. for(int dot=0; dot<(line2)*2; dot++){
  87. System.out.print(".");
  88. }
  89. for(int triangle2=Size-line2; triangle2>0; triangle2--){
  90. System.out.print("\\/");
  91. }
  92. for(int space=line2; space>0; space--){
  93. System.out.print(".");
  94. }
  95. System.out.println("|");
  96. }
  97. }
  98. }
  99.  
  100.  
  101. /*
  102. /**\
  103. //**\\
  104. ///**\\\
  105. ////**\\\\
  106. /////**\\\\\
  107. //////**\\\\\\
  108. ///////**\\\\\\\
  109. ////////**\\\\\\\\
  110. /////////**\\\\\\\\\
  111. SPACE SLASH STAR BSLASH
  112. 9 1 2 1
  113. 8 2 2
  114. 7 3 3
  115. 6 4 4
  116. 5 5 5
  117. 4 6 6
  118. 3 7 7
  119. 2 8 8
  120. 1 9 9
  121.  
  122. |..../\......../\....|
  123. |.../\/\....../\/\...|
  124. |../\/\/\..../\/\/\..|
  125. |./\/\/\/\../\/\/\/\.|
  126. |/\/\/\/\/\/\/\/\/\/\|
  127. |\/\/\/\/\/\/\/\/\/\/|
  128. |.\/\/\/\/..\/\/\/\/.|
  129. |..\/\/\/....\/\/\/..|
  130. |...\/\/......\/\/...|
  131. |....\/........\/....|
  132. Dot Slash bSlash Dot
  133. 4 1 1 8
  134. 3 2 2 6
  135. 2 3 3 4
  136. 1 4 4 2
  137. 0 5 5 0
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement