paykova

Stop

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