Advertisement
Venciity

[Java] Sunglasses

May 6th, 2014
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1. // http://judge.softuni.bg/Contests/2/CSharp-Basics-Exam-10-April-2014-Morning
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Sunglasses {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner input = new Scanner(System.in);
  9.         int n = input.nextInt();
  10.        
  11.         System.out.print(CreateSymbols(n * 2, '*'));
  12.         System.out.print(CreateSymbols(n, ' '));
  13.         System.out.println(CreateSymbols(n * 2, '*'));
  14.        
  15.         for (int i = 0; i < (n / 2) - 1; i++) {
  16.             System.out.print('*');
  17.             System.out.print(CreateSymbols((n * 2) - 2, '/'));
  18.             System.out.print('*');
  19.             System.out.print(CreateSymbols(n, ' '));
  20.             System.out.print('*');
  21.             System.out.print(CreateSymbols((n * 2) - 2, '/'));
  22.             System.out.println('*');
  23.         }
  24.         System.out.print('*');
  25.         System.out.print(CreateSymbols((n * 2) - 2, '/'));
  26.         System.out.print('*');
  27.         System.out.print(CreateSymbols(n, '|'));
  28.         System.out.print('*');
  29.         System.out.print(CreateSymbols((n * 2) - 2, '/'));
  30.         System.out.println('*');
  31.        
  32.         for (int i = 0; i < (n / 2) - 1; i++) {
  33.             System.out.print('*');
  34.             System.out.print(CreateSymbols((n * 2) - 2, '/'));
  35.             System.out.print('*');
  36.             System.out.print(CreateSymbols(n, ' '));
  37.             System.out.print('*');
  38.             System.out.print(CreateSymbols((n * 2) - 2, '/'));
  39.             System.out.println('*');
  40.         }
  41.        
  42.         System.out.print(CreateSymbols(n * 2, '*'));
  43.         System.out.print(CreateSymbols(n, ' '));
  44.         System.out.println(CreateSymbols(n * 2, '*'));
  45.     }
  46.    
  47.     public static char CreateSymbols (int n, char symbol){
  48.         for (int i = 0; i < n - 1; i++) {
  49.             System.out.print(symbol);
  50.         }
  51.         return symbol;
  52.     }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement