problem is i need to write 4 methods to display 4 different designs.
-all asterisks need to be printed by a single statement:
Code:
System.out.print('*')
- the statement:
Code:
System.out.println()
is used to move to the next line
-
Code:
System.out.print(' ')
can be used for the last 2 patterns which is what im having trouble with.
-cant be any other output statements in the program. The last 2 patterns require that each line begin with an appropriate # of blank spaces.
these are the designs:
Code:
a.
*
**
***
****
*****
******
*******
********
*********
**********
b.
**********
*********
********
*******
******
*****
****
***
**
*
c.
**********
*********
********
*******
******
*****
****
***
**
*
d.
*
**
***
****
*****
******
*******
********
*********
**********
I have a and b, just cant get c and d. here is my code.
Code:
public class Assignment1
{
public static void methodA ()
{
for (int a=11; a>0; a--)
{
for (int b=a; b<11; b++)
System.out.print("*");
System.out.println();
}
System.out.println("");
}
public static void methodB ()
{
for (int z=1; z<11; z++)
{
for (int x=z; x<11; x++)
System.out.print("*");
System.out.println();
}
}
public static void methodC ()
{
}
public static void methodD ()
{
}
public static void main (String[] args)
{
Assignment1.methodA();
Assignment1.methodB();
Assignment1.methodC();
Assignment1.methodD();
}
}
any help with c and d would be great. I keep getting infinite loops