Fig. 4.2Line art with loops and drawLine. Java how to programearly objects 10th edition: Using JCreator 4.2 Figure 4.21 displaystwo additional designs created using while loops and drawLine.
a) Create the design in the left screen capture of Fig. 4.21.Begin by dividing each edge into an equal number of increments (wechose 15 again). The first line starts in the top- left corner andends one step right on the bottom edge. For each successive line,move down one increment on the left edge and right one increment onthe bottom edge. Continue drawing lines until you reach thebottom-right corner. The figure should scale as you resize thewindow so that the endpoints always touch the edges.
b) Modify your answer in part (a) to mirror the design in allfour corners, as shown in the right screen capture of Fig. 4.21.Also, each corner should consist of a different color.
Fig. 4.21 Line art with loops and drawLine.
Fig. 4.2Line art with loops and drawLine. Java how to program early objects 10th edition: Using JCreator 4.2 Figure 4.21
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am