Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ChristmasToy {
- static String repeatString(String strToRep, int count) {
- String text = "";
- for (int i = 0; i < count; i++) {
- text += strToRep;
- }
- return text;
- }
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- String dashesFLrow = repeatString("-", 2 * n);
- String starsFLrow = repeatString("*", n);
- String FLrow = dashesFLrow + starsFLrow + dashesFLrow;
- System.out.println(FLrow);
- int a = 0;
- int x = 2;
- int y = 1;
- for (int row = 0; row < n / 2; row++) {
- String dashes = repeatString("-", (4 * n - 4) / 2 - a);
- String stars = repeatString("*", y);
- String symbol = repeatString("&", n + x);
- System.out.println(dashes + stars + symbol + stars + dashes);
- a += 2;
- x += 2;
- y++;
- }
- a = 1;
- x = 0;
- for (int row = 0; row < n / 2; row++) {
- String dashes = repeatString("-", n - a);
- String symbol = repeatString("~", 3*n-2+x);
- System.out.println(dashes+"**"+symbol+"**"+dashes);
- a++;
- x+=2;
- }
- a=0;
- x=0;
- String dashes = repeatString("-",n/2);
- String lines = repeatString("|",4*n-2);
- System.out.println(dashes+"*"+lines+"*"+dashes);
- for (int row = 0; row < n / 2; row++) {
- String dash = repeatString("-", n/2+a);
- String curls = repeatString("~",4*n-4-x);
- System.out.println(dash+"**"+curls+"**"+dash);
- a++;
- x+=2;
- }
- a=0;
- x=0;
- y=0;
- for (int row = 0; row < n / 2; row++) {
- String dash = repeatString("-",n+a);
- String star = repeatString("*", n/2-x);
- String symbol = repeatString("&",2*n-y );
- System.out.println(dash+star+symbol+star+dash);
- a+=2;
- x++;
- y+=2;
- }
- System.out.println(FLrow);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement