Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Stairs {
  3.  
  4. public static final int TOTAL_STAIRS= 8;
  5.  
  6. public static final int WIDTH= TOTAL_STAIRS*5;
  7.  
  8. public static int i;
  9.  
  10. public static void main(String[] args){
  11. for(i=1; i<=TOTAL_STAIRS; i++){
  12. space1();
  13. printTop();
  14. space2();
  15. System.out.println("*");
  16. space1();
  17. printMiddle();
  18. space2();
  19. System.out.println("*");
  20. space1();
  21. printBottom();
  22. space2();
  23. System.out.println("*");
  24. }
  25. printFloor();
  26. System.out.println();
  27. }
  28.  
  29. public static void printTop() {
  30. System.out.print(" o ******");
  31. }
  32.  
  33. public static void printMiddle() {
  34. System.out.print(" /|\\ * ");
  35. }
  36.  
  37. public static void printBottom() {
  38. System.out.print(" / \\ * ");
  39. }
  40.  
  41. public static void space1() {
  42. for(int j=1; j<=WIDTH+(i*(-5)); j++){
  43. System.out.print(" ");
  44. }
  45. }
  46.  
  47. public static void space2() {
  48. for(int j=1; j<=((i-1)*5); j++){
  49. System.out.print(" ");
  50. }
  51. }
  52.  
  53. public static void printFloor() {
  54. for(int i=1; i<= WIDTH+7; i++){
  55. System.out.print("*");
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement