Advertisement
tenachev

Java

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