Advertisement
milen_vm

Variant5 House

May 19th, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class House {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner input = new Scanner(System.in);
  8.         int n = input.nextInt();
  9.         String dots = new String(new char[n / 2]).replace("\0", ".");
  10.         String star = "*";
  11.         System.out.println(dots + star + dots);
  12.        
  13.         for (int i = 0; i < (n / 2) - 1; i++) {
  14.             dots = new String(new char[((n / 2) - 1) - i]).replace("\0", ".");
  15.             String midleDots = new String(new char[n - 2 - 2 * ((n / 2) - 1 - i)]).replace("\0", ".");
  16.             System.out.println(dots + star + midleDots + star + dots);
  17.         }
  18.         System.out.println(new String(new char[n]).replace("\0", "*"));
  19.         int wall = n / 4;
  20.         for (int i = 0; i < (n / 2) - 1; i++) {
  21.             dots = new String(new char[wall]).replace("\0", ".");
  22.             String midleDots = new String(new char[n - 2 * wall - 2]).replace("\0", ".");
  23.             System.out.println(dots + star + midleDots + star + dots);
  24.         }
  25.         star = new String(new char[n - 2 * wall]).replace("\0", "*");
  26.         System.out.println(dots + star + dots);
  27.  
  28.     }
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement