# Scalable method, using constant, to print figures; use SIZE value

• 10-11-2013, 01:48 AM
manibby93
Scalable method, using constant, to print figures; use SIZE value
I have to write a scalable method to print the following figures. It should take user input.

I learned this from a ppt, and put the numbers & stuff, but idk how to do the bottom half. The user input part...idk.
Code:

```public class ScalableMethod{ public static final int SIZE = 4; public static void main(String[] args) { topHalf(); bottomHalf(); } // Prints the expanding pattern of <> for the top half of the figure. public static void topHalf() { for (int line = 1; line <= SIZE; line++) { System.out.print("|"); for (int space = 1; space <= (line * -2 + (2*SIZE)); space++) { System.out.print(" "); } System.out.print("<>"); for (int dot = 1; dot <= (line * 4 - 4); dot++) { System.out.print("."); } System.out.print("<>"); for (int space = 1; space <= (line * -2 + (2*SIZE)); space++) { System.out.print(" "); } } }```
• 10-11-2013, 02:04 AM
Junky
Re: Scalable method, using constant, to print figures; use SIZE value
The bottom half is exactly the same as the upper half just in the opposite order.

OK can you write a program do output this:
1
2
3
4

Could you write a program to output this
4
3
2
1

Now can you write a program that outputs
1
2
3
4
4
3
2
1
• 10-11-2013, 02:17 AM
manibby93
Re: Scalable method, using constant, to print figures; use SIZE value
Lol. That made so much sense for some reason, lol. I feel slow. Thanks. Finally I understand you. :D: :(clap): My humor...

I just realized that the code doesn't even show the figure in the top half, so I'll fix it, but yeah, thanks.
• 10-11-2013, 02:45 AM
manibby93
Re: Scalable method, using constant, to print figures; use SIZE value
Can you help me w/ the user input part though??

Now it's all functional & what-not because I added this part for the bottom half:

Code:

`for (int line = SIZE; line >= 1; line--) {`
• 10-11-2013, 05:52 AM
manibby93
Re: Scalable method, using constant, to print figures; use SIZE value
Nevermind!