Guest User

Untitled

a guest
Feb 25th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Sunglasses {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scan.nextLine());
  8.  
  9. String FandLRow = repeatStr("*", n * 2)
  10. + repeatStr(" ", n)
  11. + repeatStr("*", n * 2);
  12. System.out.println(FandLRow);
  13.  
  14. for (int row = 0; row < n - 2; row++) {
  15.  
  16. String MidRow = "*"
  17. + repeatStr("/", n * 2 - 2)
  18. + "*";
  19.  
  20. if (row == (n - 1) / 2 - 1) {
  21. MidRow+=repeatStr("|", n);
  22. } else {
  23. MidRow+=repeatStr(" ", n);
  24.  
  25.  
  26. }
  27. MidRow += "*"
  28. + repeatStr("/", n * 2 - 2)
  29. + "*";
  30. System.out.println(MidRow);
  31. }
  32. System.out.println(FandLRow);
  33.  
  34.  
  35.  
  36. }
  37.  
  38. static String repeatStr(String strToRepeat, int count) {
  39. String text = "";
  40. for (int i = 0; i < count; i++) {
  41. text += strToRepeat;
  42. }
  43. return text;
  44.  
  45. }
  46. }
Add Comment
Please, Sign In to add comment