Venciity

[Java] Sunglasses by Alex

May 6th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.64 KB | None | 0 0
  1. package Exams;
  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.         char frame = '*';
  12.         char glass = '/';
  13.         char bridge = '|';
  14.         char empty = ' ';
  15.        
  16.         System.out.print(CreateSymbols(n * 2, frame));
  17.         System.out.print(CreateSymbols(n, empty));
  18.         System.out.println(CreateSymbols(n * 2, frame));
  19.        
  20.         for (int i = 0; i < (n / 2) - 1; i++) {
  21.             System.out.print(frame);
  22.             System.out.print(CreateSymbols((n * 2) - 2, glass));
  23.             System.out.print(frame);
  24.             System.out.print(CreateSymbols(n, empty));
  25.             System.out.print(frame);
  26.             System.out.print(CreateSymbols((n * 2) - 2, glass));
  27.             System.out.println(frame);
  28.         }
  29.         System.out.print(frame);
  30.         System.out.print(CreateSymbols((n * 2) - 2, glass));
  31.         System.out.print(frame);
  32.         System.out.print(CreateSymbols(n, bridge));
  33.         System.out.print(frame);
  34.         System.out.print(CreateSymbols((n * 2) - 2, glass));
  35.         System.out.println(frame);
  36.        
  37.         for (int i = 0; i < (n / 2) - 1; i++) {
  38.             System.out.print(frame);
  39.             System.out.print(CreateSymbols((n * 2) - 2, glass));
  40.             System.out.print(frame);
  41.             System.out.print(CreateSymbols(n, empty));
  42.             System.out.print(frame);
  43.             System.out.print(CreateSymbols((n * 2) - 2, glass));
  44.             System.out.println(frame);
  45.         }
  46.        
  47.         System.out.print(CreateSymbols(n * 2, frame));
  48.         System.out.print(CreateSymbols(n, empty));
  49.         System.out.println(CreateSymbols(n * 2, frame));
  50.     }
  51.    
  52.     public static char CreateSymbols (int n, char symbol){
  53.         for (int i = 0; i < n - 1; i++) {
  54.             System.out.print(symbol);
  55.         }
  56.         return symbol;
  57.     }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment