Guest User

Untitled

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