Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test14april2018;
- import java.util.Scanner;
- public class Task5 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- char quote = '\'';
- int width = 8 * n + 2;
- System.out.println("'&$" + repeat(quote, width - 3));
- for (int i = 0; i < n - 1; i++) {
- System.out.println(repeat(quote, 2 + i) + "\\" + repeat(quote, width - 3 - i));
- }
- for (int i = 0; i < width - 1; i++) {
- if (i % 2 == 0) {
- System.out.print("^");
- } else {
- System.out.print("*");
- }
- }
- System.out.println(quote);
- for (int i = 0; i < n * 4 - 1; i++) {
- if (i < n - 1) {
- System.out.println(repeat(quote, i)
- + "\\\\"
- + repeat(" ", n)
- + "\\"
- + repeat(" ", width - 6 - i * 2 - n)
- + "//"
- + repeat(quote, i + 1));
- } else if (i == n - 1) {
- System.out.println(repeat(quote, i)
- + "\\"
- + repeat("~", width - 3 - i * 2)
- + "/"
- + repeat(quote, i + 1));
- } else if (i == n * 2 - 2) {
- System.out
- .println(repeat(quote, i) + "\\" + repeat("_", width - 3 - i * 2) + "/" + repeat(quote, i + 1));
- } else if (i == n * 2 - 1) {
- System.out
- .println(repeat(quote, i) + "\\" + repeat(".", width - 3 - i * 2) + "/" + repeat(quote, i + 1));
- } else if (i == n * 4 - 2) {
- System.out
- .println(repeat(quote, i) + "\\" + repeat("_", width - 3 - i * 2) + "/" + repeat(quote, i + 1));
- } else {
- System.out
- .println(repeat(quote, i) + "\\" + repeat(" ", width - 3 - i * 2) + "/" + repeat(quote, i + 1));
- }
- }
- for (int i = 0; i < n * 2 + 1; i++) {
- System.out.println(repeat(quote, width / 2 - 2) + "|||" + repeat(quote, width / 2 - 1));
- }
- System.out.println(repeat('_', width - 1) + quote);
- System.out.println(quote + repeat('-', width - 3) + quote + quote);
- sc.close();
- }
- private static String repeat(char c, int n) {
- return repeat("" + c, n);
- }
- private static String repeat(String c, int n) {
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < n; i++) {
- result.append(c);
- }
- return result.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement