hey all...i have a homework and really i don't know how to solve this questions ...this is a period of exams and i don't have enough time to do alot of homeworks..please help me..
Q1) Using loops and control statements to draw lines can lead to many interesting designs.
a) Create the design in the left screen capture of Fig. 4.21. This design draws lines from
the top-left corner, fanning out the lines until they cover the upper-left half of the panel.
One approach is to divide the width and height into an equal number of steps (we found
15 steps worked well). The first endpoint of a line will always be in the top-left corner
(0, 0). The second endpoint can be found by starting at the bottom-left corner and
moving up one vertical step and right one horizontal step. Draw a line between the two
endpoints. Continue moving up and to the right one step to find each successive end-
point. The figure should scale accordingly as you resize the window.
b) Modify your answer in part (a) to have lines fan out from all four corners, as shown in
the right screen capture of Fig. 4.21. Lines from opposite corners should intersect along
the middle.
4.2 Figure 4.22 displays two additional designs created using while loops and drawLine.
a) Create the design in the left screen capture of Fig. 4.22. Begin by dividing each edge
into an equal number of increments (we chose 15 again). The first line starts in the top-
left corner and ends one step right on the bottom edge. For each successive line, move
down one increment on the left edge and right one increment on the bottom edge. Con-
tinue drawing lines until you reach the bottom-right corner. The figure should scale as
you resize the window so that the endpoints always touch the edges.
b) Modify your answer in part (a) to mirror the design in all four corners, as shown in the
right screen capture of Fig. 4.22.