daily pastebin goal
49%
SHARE
TWEET

STOP

bbelevski Feb 13th, 2018 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Stop {
  2.     public static void main(String[] args) {
  3.         Scanner scan = new Scanner(System.in);
  4.         int n = Integer.parseInt(scan.nextLine());
  5.  
  6. // First row
  7.         System.out.println(repeatStr(".", n+1)
  8.                 + repeatStr("_",2*n+1)
  9.                 + repeatStr(".", n+1));
  10.         //body
  11.         for (int i = 0; i < n; i++) {
  12.             String body = repeatStr(".",n-i)
  13.                     +"//"
  14.                     +repeatStr("_",(2*n-1)+2*i)
  15.                     +"\\"+"\\"
  16.                     + repeatStr(".",n-i);
  17.             System.out.println(body);
  18.         }
  19.         //middle
  20.         String middle = "//" + repeatStr("_",2*n-3)
  21.                 + "STOP!"
  22.                 + repeatStr("_",2*n-3)
  23.                 + "\\" + "\\";
  24.         System.out.println(middle);
  25.         //body down
  26.         for (int i =n  ; i > 0; i--) {
  27.             String bodyDown = repeatStr(".",n-i)
  28.                     +"\\"+"\\"
  29.                     +repeatStr("_",(2*n-1)+2*i)
  30.                     +"//"
  31.                     + repeatStr(".",n-i);
  32.             System.out.println(bodyDown);
  33.        }
  34.     }
  35.  
  36.     static String repeatStr(String strToRepeat, int count) {
  37.         String text = "";
  38.         for (int i = 0; i < count; i++) {
  39.             text += strToRepeat;
  40.         }
  41.         return text;
  42.     }
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top