Question: Working with for loops. String art is a form of art made by wrapping the colored string around a pattern of nails. First, you are

Working with for loops.

Working with for loops. String art is a form of art made

by wrapping the colored string around a pattern of nails. First, you

String art is a form of art made by wrapping the colored string around a pattern of nails. First, you are going to calculate the x, y coordinates of the nails. You will be using a Drawing Panel of size 401 by 401 (coordinate value are 0 - 400). Write a for loop counting from 0 to 20. Your first task is to calculate and print the coordinates of the A points as shown in the diagram above. The coordinates are A0 = (0, 400), A1 = (0, 380), A2 = (0, 360) ... A20 = (0, 0). Print out the result just like this. Next write loops to calculate and print the B, C, and D coordinates. Now create a 401 by 401 Drawing Panel and draw all of the edge nails as 1-pixel ovals. Write a new for loop from 0 to 20 and draw the lines connecting A0 to BO, A1 to B1, etc. You can choose the colors. You will be using the same formulas to calculate the points that you used to draw the nails. Once you get the previous part working perfectly, copy and paste It, and then modify it to draw the C-D corner gusset. Next, you are going to calculate and draw the circle nails. The nail locations are every 10 degree around a circle centered at (200, 200) and with radius 140. Remember your trigonometry: x = center X + radius * cos (angle) y = center Y + radius * sin (angle) We like to think about angles in degrees, but Java's Math package uses radians. Before you call Math. cos () and Math. sin (), use Math to Radians () to convert an angle from degrees to radians. Print your results. You should get E0 = (340.0, 200.0), E1 = (337.8, 224.3), E2 = (331.5, 247.8)... Once you have the formulas correct, draw the nails. Draw Oval (int x, int y, int w, int h) accepts only integer parameters. Use casting (int) to convert your coordinates to integers. There are two circle patterns drawn using the same nail points. The bottom circle pattern is drawn in cyan (light blue) has a line from each nail to the nail 140 degrees further around the circle. Calculate both points and draw the circle pattern. Draw the top circle in a different color. It connects nails to points 100 degrees further around the circle. If you need inspiration, search the web for "String Art

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!