import javax.swing.*;
import java.awt.*;

public class Applet_Car extends JApplet
{
	private final int APPLET_WIDTH = 800;
	private final int APPLET_HEIGHT = 380;

	private int[] xBody = {50, 50, 180, 180, 300, 300, 400, 400};
	private int[] yBody = {260, 185, 185, 120, 120, 200, 200, 260};

	private int[] xGreen = {500, 600, 650, 700, 800, 710, 690, 650, 610, 590};
	private int[] yGreen = {240, 60, 150, 60, 240, 300, 300, 270, 300, 300};


	public void init()
	{
		setBackground(Color.blue);
		setSize (APPLET_WIDTH, APPLET_HEIGHT);
	}

	public void paint (Graphics g)
	{
		g.setColor (Color.red);
		g.fillPolygon (xBody, yBody, xBody.length);	//car body

		g.setColor (Color.yellow);
		g.fillRoundRect (220, 150, 60, 50, 20, 20);	//window

		g.setColor (Color.gray);
		g.fillArc (170, 235, 80, 50, 0, 180);		//rear ark

		g.setColor (Color.gray);
		g.fillArc (320, 235, 80, 50, 0, 180);		//front ark

		g.setColor (Color.black);
		g.fillOval (180, 240, 60, 60);			//rear tire

		g.setColor (Color.black);
		g.fillOval (330, 240, 60, 60);			//front tire

		g.setColor (Color.lightGray);
		g.fillOval (195, 255, 30, 30);			//rear disk (lightGray)

		g.setColor (Color.lightGray);
		g.fillOval (345, 255, 30, 30);			//front disk (lightGray)

		g.setColor (Color.green);
		g.fillPolygon (xGreen, yGreen, xGreen.length);	//greens

		g.setColor (Color.gray);
		g.fillRect (590, 300, 20, 60);			//trunk 1

		g.setColor (Color.gray);
		g.fillRect (690, 300, 20, 60);			//trunk 2
	}
}