// A program that uses straight lines to draw around the // outline of a circle. Given a circle, draw a line between // two points on the circle separated by a certain angle. -AMH import java.awt.*; class Drawing2 extends Frame { // Constructor: set the window size to 500x500 pixels and then // draw the image to the window public Drawing2() { setSize(500,500); show(); } public void paint(Graphics g) { // accomodate for the menu and side bars of the window g.translate(getInsets().left,getInsets().top); // the center point and radius of the circle being outlined final int xCenter = 150, yCenter = 200, radius = 100; // angle between the two endpoints of the line, relative to // the center point of the circle final int separation = 45; // angle of separation between current starting point and // next starting point, relative to the center of the circle final int step = 5; // starting point of current line, as an angle relative to // the center of the circle int currAngle = 0; g.setColor(Color.black); // get starting points from around the entire circle while (currAngle < 360) { g.drawLine((int)(radius * Math.cos(currAngle)) + xCenter, (int)(radius * Math.sin(currAngle)) + yCenter, (int)(radius * Math.cos(currAngle+separation)) + xCenter, (int)(radius * Math.sin(currAngle+separation)) + yCenter); currAngle += step; } } } public class linedrawing { public static void main (String[ ] args) { Drawing2 d = new Drawing2(); } }