So the drawing is a little off, but I\'m trying to write a Java program with mul
ID: 3644826 • Letter: S
Question
So the drawing is a little off, but I'm trying to write a Java program with multiple methods using for loops to ouput the following design. I think if I can just get started, I'll be okay, but I'm having trouble even breaking down which parts of the drawing I want to assign to a particular method. Any ideas? (and yes, the column of asterisks all the way to the right are supposed to be aligned with each other).o *******
/| * *
/ * *
o ****** *
/| * *
/ * *
o ****** *
/| * *
/ * *
o ****** *
/| * *
/ * *
**************************
Explanation / Answer
please rate - thanks
public class stairs
{static int number= 4;
static int stars=6;
static int upto=0;
public static void main(String[] args)
{int i;
for(upto=number;upto>0;upto--)
person();
for(i=0;i<stars;i++)
System.out.print(" ");
for(i=0;i<(number+1)*stars;i++)
System.out.print("*");
}
public static void person()
{int i;
printblanks();
print2blanks();
System.out.print("o");
print2blanks();
for(i=0;i<3;i++)
System.out.print("**");
printstar();
printblanks();
System.out.print(" /");
System.out.print("|\");
System.out.print(" *");
print2blanks();
print2blanks();
System.out.print(" ");
printstar();
printblanks();
System.out.print(" /");
System.out.print(" \");
System.out.print(" *");
print2blanks();
print2blanks();
System.out.print(" ");
printstar();
}
public static void print2blanks()
{System.out.print(" ");
}
public static void printblanks()
{int i;
for(i=0;i<upto*stars;i++)
System.out.print(" ");
}
public static void printstar()
{int i;
for(i=0;i<stars*(number-upto);i++)
System.out.print(" ");
System.out.println("*");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.