I am completing the exercises in
Java How To Program 8th Edition by Harvey and Paul Deitel.
There are two optional exercises GUI and Graphics Case Study Exercises on page 141 Chapter 4.
I have to use loops and control statements to draw lines thereby creating two designs.
I am trying to create the design on Fig. 4.20. The lines do not line up correctly.
The lines should fan out from all corners. Individually, they look exactly like it should.
Example of one corner.
For the other corners I have different starting and ending positions.
To draw upper-left corner I have a starting position of 0,0 and ending position of 0,height.
I then move ending position up one vertical step and right one horizontal step. I repeat this
fifteen times.
To draw upper-right corner I have a starting position of width,0 and ending position of
width,height. I then move ending position up one vertical step and left one horizontal step.
To draw bottom-left corner I have a starting position of 0,height and ending position of
0,0. I then move ending position down one vertical step and right one horizontal step.
To draw bottom-right corner I have a starting position of width, height and ending position of
width,0. I then move ending position down one vertical step and left one horizontal step.
For the second design Fig. 4.21 all my lines line up correctly no matter the direction I
resize it. Both designs frame size is 250,250. Both designs are divided into fifteen steps.