Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to draw a triangle and circle?

807607Nov 3 2006 — edited Nov 10 2006
hey

I've an array filled with "."s representing empty sapces, and "X"s non-empty sapces. I've to draw a triangle, for given hieght, width, starting row&col and cricle for given diameter.

For example if you have followings:
. . . . . . . . . .
. . . . x . . . . .
. . . x x x . . . .
. . x x x x x . . .
. x x x x x x x . .
. . . . . . . . . .

. . . . . . . . . 
. . x x x . . . . 
. x x x x x . . . 
x x x x x x x . . 
x x x x x x x . . 
x x x x x x x . . 
. x x x x x . . . 
. . x x x . . . . 
The first picture shows triangle with height = 4, width = 7 and starting row = 1 and col = 1, means the first "X" on last line has col = 1 and "X" on first line has row = 1. The second picture shows a circle, with diameter 7, start row = 1 and start col = 0.

For triangle, i tried different methods, but it doesn't work for all the cases and for circle i've no idea. Any help, hints, suggestion would be really apperciated, tons of thanks in advance!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 8 2006
Added on Nov 3 2006
3 comments
344 views