Guest User

Untitled

a guest
Sep 1st, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Cup {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scanner.nextLine());
  8.  
  9. int j = 0;
  10.  
  11. for (int row = 0; row < n /2; row++) {
  12. System.out.print(repeatStr(".", n+row));
  13. System.out.print(repeatStr("#", 5*n-2*(n+row)));
  14. System.out.println(repeatStr(".", n+row));
  15. j = n + row;
  16. }
  17. for (int row = 0; row < n / 2 + 1; row++){
  18. System.out.printf("%s#%s#%s%n",repeatStr(".", j+row+1),
  19. repeatStr(".",5*n-2*(j+row+2)),
  20. repeatStr(".", j+row+1));
  21. }
  22. System.out.printf("%s%s%s\n",repeatStr(".",2*n),
  23. repeatStr("#",n),
  24. repeatStr(".",2*n));
  25. for (int col = 0; col < n/2; col++){
  26. System.out.print(repeatStr(".", 2 *n -2));
  27. System.out.print(repeatStr("#", 5*n-2*(2*n-2)));
  28. System.out.println(repeatStr(".", 2 *n -2));
  29. }
  30. System.out.print(repeatStr(".", (5*n-10)/2));
  31. System.out.print("D^A^N^C^E^");
  32. System.out.println(repeatStr(".", (5*n-10)/2));
  33.  
  34. for (int col = 0; col < n/2+1; col++){
  35. System.out.print(repeatStr(".", 2 *n -2));
  36. System.out.print(repeatStr("#", 5*n-2*(2*n-2)));
  37. System.out.println(repeatStr(".", 2 *n -2));
  38. }
  39.  
  40. }
  41. static String repeatStr(String strToRepeat, int count) {
  42. String text = "";
  43.  
  44. for (int i = 0; i < count; i++) {
  45. text = text + strToRepeat;
  46. }
  47.  
  48. return text;
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment