BubaLazi

p05_Fox

Mar 15th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Fox {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.  
  7.         int n = Integer.parseInt(console.nextLine());
  8.  
  9.         int stars = 0;
  10.         int dashes = (2 * n) + 1;
  11.         int stars1 = (2 * n) + 1;
  12.         int dashes1 = 0;
  13.         int middleStars = n;
  14.         int endStars = (n - 1)/2;
  15.  
  16.         for (int i = 0; i < n ; i++) {
  17.             stars = stars + 1;
  18.             dashes = dashes - 2;
  19.             System.out.printf("%s\\%s/%s\n", repeatStr("*", stars),
  20.                     repeatStr("-", dashes), repeatStr("*", stars));
  21.         }
  22.         for (int j = 0; j < n / 3; j++) {
  23.             System.out.printf("|%s\\%s/%s|\n", repeatStr("*", endStars),
  24.                     repeatStr("*", middleStars), repeatStr("*", endStars));
  25.             endStars = endStars + 1;
  26.             middleStars = middleStars - 2;
  27.         }
  28.         for (int y = 0; y < n; y++) {
  29.             stars1 = stars1 - 2;
  30.             dashes1 = dashes1 + 1;
  31.             System.out.printf("%s\\%s/%s\n", repeatStr("-", dashes1),
  32.                     repeatStr("*", stars1), repeatStr("-", dashes1));
  33.  
  34.         }
  35.     }
  36.     static String repeatStr(String strToRepeat, int count) {
  37.         String text = "";
  38.  
  39.         for (int i = 0; i < count; i++) {
  40.             text = text + strToRepeat;
  41.         }
  42.  
  43.         return text;
  44.     }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment