File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes how to complete this code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to complete this code?" Watch "how to complete this code?" New topic
Author

how to complete this code?

riris wijaya
Greenhorn

Joined: Mar 16, 2012
Posts: 7
hi all, i am new. i tried to make this


here is my scrip, i can complete the middle part. this (\_/) part. can anyone help me???
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7499
    
  18

riris wijaya wrote:The rest is all spacing, the trickiest part.

It may look it, but actually it isnt (BTW - excellent analysis, you'd get an 'A' from me; I wish more newbies showed the same application).

If you look at your patterns closely, you'll see that they repeat. If I was doing it, I wouldn't worry too much about spaces on the right (so, you print extra spaces on a line; who cares?) it may help you to see how to put your "shapes" together.

For me, there are 6 basic shapes:
1. Hex top (see line 0).
2. Left top and right top (line 1, but two distinct shapes that may need to be used separately).
3. Left edge and right edge (line 3, but again, two distinct shapes that may need to be used separately; and needed only once, from the looks of it).
4. A "cup" (the teacup without a handle, used everywhere else).
The rest is all leading spaces.

See if that helps any.

Good luck.

Winston

[Edit] Looking at it again, there are other ways of looking at the pattern, but I'd get what you have working first, then look for alternatives.


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
. . . and welcome to the Ranch
 
Don't get me started about those stupid light bulbs.
 
subject: how to complete this code?
 
Similar Threads
Mouse listener question
JTextFields & storing data
How to extract the value?
Storing objects polymorphically in a Figure array
Help in Algorithm Construction