Answer:
See explaination
Step-by-step explanation:
public class Drawquadrilatral
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Polygon p = new Polygon();
for (int k = 0; k < 7; k++)
p.addPoint((int) (200 + 60 * Math.cos(k * 2 * Math.PI / 9)),
(int) (200 + 60 * Math.sin(k * 8 * Math.PI / 5)));
g.drawPolygon(p);
Polygon s = new Polygon();
for (int k = 0; k < 360; k++)
{
double m = k / 360.0;
s.addPoint((int) (150 + 50 * m * Math.cos(8 * m * Math.PI)),
(int) (150 + 50 * m * Math.sin(8 * m * Math.PI)));
}
g.drawPolygon(s);
}
public static void main(String[] args)
{
JFrame frame = new JFrame();
frame.setTitle("DrawPoly");
frame.setSize(350, 250);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
Container contentPane = frame.getContentPane();
contentPane.add(new DrawPolyPanel());
frame.show();
}
}