Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Stairs {
- public static final int TOTAL_STAIRS= 8;
- public static final int WIDTH= TOTAL_STAIRS*5;
- public static int i;
- public static void main(String[] args){
- for(i=1; i<=TOTAL_STAIRS; i++){
- space1();
- printTop();
- space2();
- System.out.println("*");
- space1();
- printMiddle();
- space2();
- System.out.println("*");
- space1();
- printBottom();
- space2();
- System.out.println("*");
- }
- printFloor();
- System.out.println();
- }
- public static void printTop() {
- System.out.print(" o ******");
- }
- public static void printMiddle() {
- System.out.print(" /|\\ * ");
- }
- public static void printBottom() {
- System.out.print(" / \\ * ");
- }
- public static void space1() {
- for(int j=1; j<=WIDTH+(i*(-5)); j++){
- System.out.print(" ");
- }
- }
- public static void space2() {
- for(int j=1; j<=((i-1)*5); j++){
- System.out.print(" ");
- }
- }
- public static void printFloor() {
- for(int i=1; i<= WIDTH+7; i++){
- System.out.print("*");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement