Advertisement
paykova

Rocket

Oct 23rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Rocket {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scanner.nextLine());
  8.  
  9. for (int i = 0; i < n; i++) {
  10. String loop1 = repeatStr(".", (3*n-2)/2 - i)
  11. + "/"
  12. + repeatStr(" ", 2 * i)
  13. + "\\"
  14. + repeatStr(".", (3*n-2)/2 - i);
  15. System.out.println(loop1);
  16.  
  17. }
  18. String staticLine = repeatStr(".", n / 2)
  19. + repeatStr("*", 2 * n)
  20. + repeatStr(".", n / 2);
  21. System.out.println(staticLine);
  22.  
  23. for (int i = 0; i <2*n ; i++) {
  24. String body = repeatStr(".", n/2)
  25. + "|"
  26. + repeatStr("\\", 2*n - 2)
  27. + "|"
  28. + repeatStr(".", n/2);
  29. System.out.println(body);
  30.  
  31. }
  32.  
  33. for (int i = 0; i <n/2 ; i++) {
  34. String end = repeatStr(".", n/2 - i)
  35. + "/"
  36. + repeatStr("*", 2*n - 2 + 2*i)
  37. + "\\"
  38. + repeatStr(".", n/2 - i);
  39. System.out.println(end);
  40.  
  41.  
  42. }
  43. }
  44.  
  45. static String repeatStr(String strToRepeat, int count) {
  46. String text = "";
  47. for (int i = 0; i < count; i++) {
  48. text += strToRepeat;
  49. }
  50. return text;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement