0% found this document useful (0 votes)
5 views2 pages

Code

The document draws various shapes and colors to create an image of food on a plate including a salt shaker, pepper shaker, rectangles, arcs, an oval plate, a rectangle plate rim, oval food items like leaves and mashed potatoes.

Uploaded by

Sivani P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Code

The document draws various shapes and colors to create an image of food on a plate including a salt shaker, pepper shaker, rectangles, arcs, an oval plate, a rectangle plate rim, oval food items like leaves and mashed potatoes.

Uploaded by

Sivani P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

/salt

Color salt = new Color (211,211,211);


Polygon saltp = new Polygon();
saltp.addPoint(120,80);
saltp.addPoint(220,80);
saltp.addPoint(140,180);
saltp.addPoint(200,180);
g.fillPolygon(saltp);

//pepper
Color pepp = new Color (179,179,179);
Polygon pep = new Polygon();
pep.addPoint(280,180);
pep.addPoint(380,180);
pep.addPoint(300,280);
pep.addPoint(360,280);
g.fillPolygon(pep);

//rectangles
Color saltr = new Color (243,243,243);
g.setColor(saltr);
g.fillRect(120,60,100,20);

Color pepr = new Color (155,142,142);


g.setColor(pepr);
g.fillRect(280,160,100,20);

//arcs
Color sArc = new Color (195,188,188);
g.setColor(sArc);
g.fillArc(140,160,60,40,180,180);

Color pArc = new Color (134,127,127);


g.setColor(pArc);
g.fillArc(300,260,60,40,180,180);

//food...
//plate

g.setColor(Color.WHITE);
g.fillOval(40,360,400,100);

g.fillRect(150,450,180,20);

//food on the plate - leaves

Color food1 = new Color (0,100,0);


g.setColor(food1);
g.fillOval(100,380,60,40);

//mashpotatoes

Color mash = new Color (255,244,198);


g.setColor(mash);
g.fillOval(140,380,240,60);
Color mashoutline = new Color (232,206,170);
g.setColor(mashoutline);
g.drawOval(140,380,240,60);

g.setColor(mash);
g.fillOval(180,370,150,40);
g.setColor(mashoutline);
g.drawOval(180,370,150,40);

//food2 - leaves
g.setColor(food1);
g.fillOval(340,390,60,40);

You might also like