Advertisement
zainarfi00

Chapter 2 Projects

Sep 21st, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.55 KB | None | 0 0
  1. /**
  2. * Pg 132 number 1 Project
  3. *
  4. * Zain Arfi
  5. * v1
  6. */
  7. public class Project1
  8. {
  9. public static void main(String[] args)
  10. {
  11. for(int row=1; row<=7; row++)
  12. {
  13. for(int star=1; star<=(row*-1+7); star++)
  14. {
  15. System.out.print("*");
  16. }
  17. for(int spaces=1; spaces<=(row-1); spaces++)
  18. {
  19. System.out.print(" ");
  20. }
  21. for(int fs=1; fs<=(row*-2+14); fs++)
  22. {
  23. System.out.print("/");
  24. }
  25. for(int bs=1; bs<=(row*2-2); bs++)
  26. {
  27. System.out.print("\\");
  28. }
  29. for(int spaces=1; spaces<=(row-1); spaces++)
  30. {
  31. System.out.print(" ");
  32. }
  33. for(int star=1; star<=(row*-1+7); star++)
  34. {
  35. System.out.print("*");
  36. }
  37. System.out.println();
  38. }
  39. }
  40. }
  41.  
  42.  
  43. /**
  44. Pg 132 number 2 Project
  45. *
  46. * Zain Arfi
  47. * v1
  48. */
  49. public class Project2
  50. {
  51. public static void main(String[]args)
  52. {
  53. System.out.println("+------+");
  54. for(int row=1; row<=6; row++)
  55. {
  56. System.out.println("|");
  57. for(int spaces=1; spaces<=(row*1+3); spaces++)
  58. {
  59. System.out.print(" ");
  60. }
  61. System.out.print("^");
  62. for(int spaces2=1; spaces2<=(row*2-2); spaces2 ++)
  63. {
  64. System.out.print(" ");
  65. }
  66. System.out.print("^");
  67. for(int spaces=1; spaces<=(row*1+3); spaces++)
  68. {
  69. System.out.print(" ");
  70. }
  71. System.out.print("|");
  72. System.out.println();
  73. System.out.println("+------+");
  74. System.out.println("|");
  75. for(int spaces3=1; spaces3<=(row-1); spaces3++)
  76. {
  77. System.out.print(" ");
  78. }
  79. System.out.print("V");
  80. for(int spaces4=1; spaces4<=(row*-2+6); spaces4++)
  81. {
  82. System.out.print(" ");
  83. }
  84. System.out.print("V");
  85. for(int spaces3=1; spaces3<=(row-1); spaces3++)
  86. {
  87. System.out.print(" ");
  88. }
  89. System.out.println("+------+");
  90. }
  91. }
  92. }
  93.  
  94.  
  95.  
  96. /**
  97. * Pg 132 number 6 Project
  98. *
  99. * Zain Arfi
  100. * v1
  101. */
  102. public class Project6
  103. {
  104. public static void main(String[] args)
  105. {
  106. for(int row=1; row<=5; row++)
  107. {
  108. for(int spaces=1; spaces<=(row*-1+5); spaces++)
  109. {
  110. System.out.println(" ");
  111. }
  112. for(int slash=1; slash<=(row*1); slash++)
  113. {
  114. System.out.print("/");
  115. }
  116. System.out.print("**");
  117. for(int slash2=1; slash2<=(row*2); slash2++)
  118. {
  119. System.out.print("\\");
  120. }
  121. }
  122. System.out.println("+=*=*=*=*=*=*=+");
  123. for(int row2=1; row2<=6; row2++)
  124. {
  125. System.out.println("|");
  126. for(int dot=1; dot<=(row2*-1+3); dot++)
  127. {
  128. System.out.print(".");
  129. }
  130. for(int slashes=1; slashes<=(row2*1); slashes++)
  131. {
  132. System.out.print("/\\");
  133. }
  134. for(int dot2=1; dot2<=(row2*1-1); dot2++)
  135. {
  136. System.out.print(".");
  137. }
  138. for(int slashes=1; slashes<=(row2*1); slashes++)
  139. {
  140. System.out.print("/\\");
  141. }
  142. for(int dot=1; dot<=(row2*-1+3); dot++)
  143. {
  144. System.out.print(".");
  145. }
  146. System.out.print("|");
  147. }
  148. System.out.println("+=*=*=*=*=*=*=+");
  149. for(int row3=1; row3<=6; row3++)
  150. {
  151. System.out.println("|");
  152. for(int slashes2=1; slashes2<=(row3*-1+4); slashes2++)
  153. {
  154. System.out.print("\\/");
  155. }
  156. for(int dot2=1; dot2<=(row3*1-1); dot2++)
  157. {
  158. System.out.print(".");
  159. }
  160. for(int dot=1; dot<=(row3*-1+3); dot++)
  161. {
  162. System.out.print(".");
  163. }
  164. for(int slashes=1; slashes<=(row3*1); slashes++)
  165. {
  166. System.out.print("/\\");
  167. }
  168. for(int dot=1; dot<=(row3*-1+3); dot++)
  169. {
  170. System.out.print(".");
  171. }
  172. }
  173. }
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement