Advertisement
paykova

SoftUniCamp

Oct 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SoftUniLogo {
  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(".", (12*n-6)/2)
  10. + "#"
  11. + repeatStr(".", (12*n-6)/2);
  12. System.out.println(firstLine);
  13.  
  14. for (int i = 0; i < 2*n - 2; i++) {
  15. String roof = repeatStr(".", 6*n - 6 - 3*i)
  16. + repeatStr("#", 7 + 2*3*i)
  17. + repeatStr(".", 6*n - 6 - 3*i);
  18. System.out.println(roof);
  19. }
  20.  
  21. String staticLine = repeatStr("#", 12*n - 5);
  22. System.out.println(staticLine);
  23.  
  24. for (int i = 0; i < n-2; i++) {
  25. String underTheRoof = "|"
  26. + repeatStr(".", 2 + 3*i)
  27. + repeatStr("#", 12*n - 11 -2*3*i)
  28. + repeatStr(".", 3 + 3*i);
  29. System.out.println(underTheRoof);
  30.  
  31. }
  32.  
  33.  
  34. for (int i = 1; i <=n ; i++) {
  35. if (i/n != 1){
  36. String bottom = "|"
  37. + repeatStr(".", (6*n-6)/2 - 1)
  38. + repeatStr("#", 6*n+1)
  39. + repeatStr(".", (6*n-6)/2);
  40. System.out.println(bottom);
  41. } else {
  42. String bottom = "@"
  43. + repeatStr(".", (6*n-6)/2 - 1)
  44. + repeatStr("#", 6*n+1)
  45. + repeatStr(".", (6*n-6)/2);
  46. System.out.println(bottom);
  47.  
  48. }
  49.  
  50.  
  51. }
  52. }
  53. static String repeatStr(String strToRepeat, int count) {
  54. String text = "";
  55. for (int i = 0; i < count; i++) {
  56. text += strToRepeat;
  57. }
  58. return text;
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement