Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 procedures
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
baby_bubblz




PostPosted: Sat Apr 16, 2005 1:53 pm   Post subject: procedures

hi i have a problem i'm having a lot of trouble with. if anyone could help it'll be great. thanks!

problem: make a procedure subprogram that creates a butterfly. It consists of 6 parameters: 2 for the bottom-left corner of the box where the butterfly is located in, 2 for the top right corner, 1 for the colour of the body, and 1 for the colour of its wings. however big or small the box is, the butterfly should always retain its shape.
Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Sat Apr 16, 2005 2:10 pm   Post subject: (No subject)

What does the box do? And you mean something like this?
code:
procedure butterfly (x1,y1,x2,y2,flycol,wingcol:int)
end butterfly
baby_bubblz




PostPosted: Sat Apr 16, 2005 2:23 pm   Post subject: (No subject)

yeah, the box is just where the butterfly is in
jamonathin




PostPosted: Sat Apr 16, 2005 3:13 pm   Post subject: (No subject)

Ok, but your question makes no sense. Are you supposed to draw a butterfly that flies around in a box? like this?
baby_bubblz




PostPosted: Sat Apr 16, 2005 3:24 pm   Post subject: (No subject)

sorry about the confusion, no the butterfly doesn't fly and doesn't move. it's just an oval for the body, and 4 circles as wings. Whatever the user inputs as the coordinates of the box, the butterfly will always be in the box, whether the box is stretched or compress, the butterfly will stretch or compress as well.
Cervantes




PostPosted: Sat Apr 16, 2005 3:45 pm   Post subject: (No subject)

On paper, draw a rectangle. Then draw the butterfly, inside that rectangle. Measure the lengths of the rectangle, then measure the lengths and positions of the various parts of the butterfly. Divide those measurements by the lengths of the sides of the rectangle, so that you get ratios. For example, the centre of the oval that is the wing is 0.5 up and has a radius (in the y) of 0.2. So it's centre would be half way up and it would be have a radius 1/5 of the height of the rectangle you're drawing it in.

Once you've got all your ratios, start to code it.
You'll probably have a local variable for the width of the rectangle and another for the height of the rectangle. Thats just x2 - x1 and y2 - y1.

Cervantes
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: